public class DataSocket
extends javax.websocket.Endpoint
implements javax.websocket.MessageHandler.Whole<java.lang.String>
/Data
" service first using the POST method to subscript to the data to receive events on.
For example: when using a JavaScript client, use the WebSocket() constructor to create a connection.
Once the connection is opened, it listens for messages on the socket in the form of "sessionid". So, a client would need to send the "sessionid" as a message to the socket every time it wants more data.
Constructor and Description |
---|
DataSocket() |
Modifier and Type | Method and Description |
---|---|
void |
onClose(javax.websocket.Session session,
javax.websocket.CloseReason closeReason)
The user closes the connection.
|
void |
onMessage(java.lang.String params)
When a user sends a message to the server, this method will intercept the message
and allow us to react to it.
|
void |
onOpen(javax.websocket.Session session,
javax.websocket.EndpointConfig config)
OnOpen allows us to intercept the creation of a new session.
|
public void onOpen(javax.websocket.Session session, javax.websocket.EndpointConfig config)
onOpen
in class javax.websocket.Endpoint
session
- An instance to a Session.public void onClose(javax.websocket.Session session, javax.websocket.CloseReason closeReason)
onClose
in class javax.websocket.Endpoint
session
- An instance to a Session.closeReason
- The reason the socket was closed.public void onMessage(java.lang.String params)
onMessage
in interface javax.websocket.MessageHandler.Whole<java.lang.String>
params
- A semicolon separated list of parameters.
The first parameter is the session id.