-
Notifications
You must be signed in to change notification settings - Fork 6
WebSocket API
The WebSocket object is passed into many of the event handling methods as an argument named websocket
. It implements the javax.websocket.Session
interface, and allows you to interact with the connection via the methods below.
Closes the connection and optionally returns the numeric code and text description
@param code - integer as per http://docs.oracle.com/javaee/7/api/javax/websocket/CloseReason.CloseCodes.html
@param description - string describing the reason for closing the connection
@returns the Application Scope that is associated with this connection
see https://docs.oracle.com/javaee/7/api/javax/websocket/Session.html#getAsyncRemote--
see https://docs.oracle.com/javaee/7/api/javax/websocket/Session.html#getBasicRemote--
@returns an Array with the names of the channels to which this connection is subscribed
Returns the ConnectionManager for this connection. see ConnectionManager API
see https://docs.oracle.com/javaee/7/api/javax/websocket/Session.html#getId--
see https://docs.oracle.com/javaee/7/api/javax/websocket/Session.html#getMaxIdleTimeout--
see https://docs.oracle.com/javaee/7/api/javax/websocket/Session.html#getOpenSessions--
@returns a struct with the path parameters that were used in placeholders. For example, if
the endpoint is /ws/chat/{channel}
and the client connects to /ws/chat/developers
, then
the struct will have the key channel
with the value developers
.
see http://docs.oracle.com/javaee/7/api/javax/websocket/Session.html#getPathParameters--
see http://docs.oracle.com/javaee/7/api/javax/websocket/Session.html#getQueryString--
see https://docs.oracle.com/javaee/7/api/javax/websocket/Session.html#getRequestURI--
@returns the Session Scope that is associated with this connection
see https://docs.oracle.com/javaee/7/api/javax/websocket/Session.html#getUserProperties--
@returns the actual javax.websocket.Session object
see https://docs.oracle.com/javaee/7/api/javax/websocket/Session.html#isOpen--
see https://docs.oracle.com/javaee/7/api/javax/websocket/Session.html#isSecure--
Sends the message to the WebSocket client. Returns true if the connection was still open, or false if it was closed.
Sends the message to the WebSocket client asynchronously. Returns true if the connection was still open, or false if it was closed.
see https://docs.oracle.com/javaee/7/api/javax/websocket/Session.html#setMaxIdleTimeout-long-
Subscribes the WebSocket connection to the given channel.
Unsubscribes the WebSocket connection from the given channel.
Unsubscribes the WebSocket connection from all channels.