|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.grizzly.websockets.WebSocketApplication<W>
public abstract class WebSocketApplication<W extends WebSocket>
Abstract server-side WebSocket application, which will handle
application WebSockets events.
WebSocketHandler,
WebSocketClientHandler| Constructor Summary | |
|---|---|
WebSocketApplication()
|
|
| Method Summary | |
|---|---|
boolean |
add(W websocket)
Add the WebSocket to the WebSocketApplication websockets list. |
protected W |
createWebSocket(Connection connection,
ServerWebSocketMeta meta)
Method is called before the WebSocketEngine will create a server-side
WebSocket object, so application may return any customized
subtype of WebSocket. |
protected Set<W> |
getWebSockets()
Returns a set of WebSockets, registered with the application. |
protected void |
handshake(ClientWebSocketMeta websocketMeta)
Method is called, when inital WebSocket handshake process was completed,
but WebSocketApplication may perform additional validation. |
void |
onAccept(W websocket)
Method is called, when new WebSocket gets accepted. |
void |
onClose(W websocket)
Method is called, when WebSocket gets closed. |
boolean |
remove(W socket)
Remove the WebSocket from the WebSocketApplication websockets list. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.glassfish.grizzly.websockets.WebSocketHandler |
|---|
onMessage |
| Constructor Detail |
|---|
public WebSocketApplication()
| Method Detail |
|---|
public void onAccept(W websocket)
throws IOException
WebSocket gets accepted.
Default implementation just register the passed WebSocket to a
set of application associated WebSockets.
websocket - WebSocket
IOException
public void onClose(W websocket)
throws IOException
WebSocket gets closed.
onClose in interface WebSocketHandler<W extends WebSocket>websocket - WebSocket
IOExceptionprotected Set<W> getWebSockets()
WebSockets, registered with the application.
The returned set is unmodifiable, the possible modifications may cause exceptions.
WebSockets, registered with the application.public boolean add(W websocket)
WebSocket to the WebSocketApplication websockets list.
websocket - WebSocket to add.
WebSocket was successfully added, or
false otherwise.public boolean remove(W socket)
WebSocket from the WebSocketApplication websockets list.
socket - WebSocket to remove.
WebSocket was succeessfully removed, or
false otherwise.
protected void handshake(ClientWebSocketMeta websocketMeta)
throws HandshakeException
WebSocket handshake process was completed,
but WebSocketApplication may perform additional validation.
websocketMeta - ClientWebSocketMeta.
HandshakeException - error, occurred during the handshake.
protected W createWebSocket(Connection connection,
ServerWebSocketMeta meta)
WebSocketEngine will create a server-side
WebSocket object, so application may return any customized
subtype of WebSocket.
connection - underlying Grizzly Connection.meta - server-side ServerWebSocketMeta.
WebSocket, or null, if application wants
to delegate WebSocket creation to WebSocketEngine.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||