Skip to content

WebSocket API

Igal edited this page Apr 8, 2017 · 13 revisions

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.

getApplicationScope()

@returns the Application Scope that is associated with this connection

getAsyncRemote()

getBasicRemote()

getConnectionManager()

see ConnectionManager API

getId()

see https://docs.oracle.com/javaee/7/api/javax/websocket/Session.html#getId--

getMaxIdleTimeout()

see https://docs.oracle.com/javaee/7/api/javax/websocket/Session.html#getMaxIdleTimeout--

getOpenSessions()

see https://docs.oracle.com/javaee/7/api/javax/websocket/Session.html#getOpenSessions--

getRequestURI()

getSessionScope()

@returns the Session Scope that is associated with this connection

getUserProperties()

isOpen()

isSecure()

sendText(string message)

sendTextAsync(string message)

setMaxIdleTimeout(long milliseconds)

subscribe(string channel)

Subscribes the WebSocket connection to the given channel.

unsubscribe(string channel)

Unsubscribes the WebSocket connection from the given channel.

unsubscribeAll()

Unsubscribes the WebSocket connection from all channels.

TODO: add close() and close(reason)

Clone this wiki locally