public class DataStreaming
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 a message on the socket in the form of "sessionid;interval". Once received, the data is transmitted back to the client every "interval". The client does not have to poll for the data. "interval" is in milliseconds and defaults to 100ms.
Constructor and Description |
---|
DataStreaming() |
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.