(Service) The main service for handling
If creating a BedApp
Broadcasts the given message to all open WebSockets, or to just the WebSockets associated with the given IDs. This is a safe operation, as in if a WebSocket for a given ID could not be found, it is silently ignored.
WebSocketassociated with the given ID. Note that closed WebSockets no longer exist.
If a WebSocket could not be found then either
nullis returned or an
ArgErris thrown dependant on the value of
Hook to allow negotiation of websocket protocols and extensions. Called after the socket upgrade has been verified but before the response has been committed (and before the response headers have been sent).
This field may be set at any time.
Services the given
WebSocket. The active HTTP request is upgraded to a WebSocket connection. This call then enters a read loop and blocks until the WebSocket is closed.
abstract Void shutdown()
Closes all open WebSockets.
abstract Duration? socketReadTimeOut
The maximum amount of time a websocket blocks for while waiting for a message from the client. After this time the socket times out and the WebSocket closes.
nullfor an infinite timeout - but a word of caution, this then leaves you vulnerable to DOS attacks.
This field may be set at any time, but only affects WebSockets connected after the change.