@WebSocket
public class WebsocketServerEvents
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
WebsocketServerController |
ctrl |
org.eclipse.jetty.websocket.api.Session |
session |
Constructor and Description |
---|
WebsocketServerEvents(WebsocketServerController ctrl) |
Modifier and Type | Method and Description |
---|---|
void |
handleClose(int statusCode,
java.lang.String reason)
Handles closing down a specific client connection, and removes the client from the list of clients
|
void |
handleConnect(org.eclipse.jetty.websocket.api.Session session)
Handles new client connections, and adding the client to a list of clients, so that we can send messages to it later
|
void |
handleError(java.lang.Throwable error)
Handling connection errors and writes the to the console
|
void |
handleMessage(java.lang.String message)
Handles incoming messages, and passes them on to the Processing sketch's websocket event method
|
public org.eclipse.jetty.websocket.api.Session session
public WebsocketServerController ctrl
public WebsocketServerEvents(WebsocketServerController ctrl)
@OnWebSocketConnect public void handleConnect(org.eclipse.jetty.websocket.api.Session session)
session
- The connection session between the server and a specific client (not all clients!)@OnWebSocketClose public void handleClose(int statusCode, java.lang.String reason)
statusCode
- Reason code for closing the connectionreason
- Description of close down reason@OnWebSocketMessage public void handleMessage(java.lang.String message)
message
- The incoming message@OnWebSocketError public void handleError(java.lang.Throwable error)
error
- The error that occurred