Interface WebSocket<T>
- All Known Implementing Classes:
AbstractWebsocketDefinition
,AnonymousWebsocket
,LoggingWebsocketDefinition
,ModelValidationWebsocketDefinition
,NotificationWebsocketDefinition
,SecureWebsocket
,SqlLoggingWebsocketDefinition
public interface WebSocket<T>
-
Method Summary
Modifier and TypeMethodDescriptionCreate an instance of the WebSocket implementation.getPath()
The relative path where this endpoint should be published.void
onHandshake
(Map<String, Object> userProperties) Called when the WebSocket connection is initialized.void
sendMessage
(Callable<Optional<String>> message) Sends a message to all clients that are connected to this endpoint.void
sendMessageToOrigin
(String originId, Callable<Optional<String>> message) Sends a message to a certain client.default void
sendMessageToUser
(String username, Callable<Optional<String>> message) Class
of the WebSocket implementation (must extend javax.websocket.Endpoint)
-
Method Details
-
webSocketClass
Class
of the WebSocket implementation (must extend javax.websocket.Endpoint) -
createWebSocketInstance
T createWebSocketInstance()Create an instance of the WebSocket implementation. This method allows custom initialization of the WebSocket class.A new instance will be created for every new WebSocket connection.
-
getPath
String getPath()The relative path where this endpoint should be published. Should start with '/nice2/websocket/' for consistency reasons. -
onHandshake
Called when the WebSocket connection is initialized. This is called from a normal HTTP Request, so authentication data is still available at this point.Data stored in the given map will later be available from the WebSocket session.
-
sendMessage
Sends a message to all clients that are connected to this endpoint.The given callable will be evaluated using the security and business unit contexts of the client.
-
sendMessageToOrigin
Sends a message to a certain client.The given callable will be evaluated using the security and business unit contexts of the client.
-
sendMessageToUser
-