WebSocket.CloseStatus, WebSocket.Definition, WebSocket.Handler<T>, WebSocket.OnClose, WebSocket.OnError, WebSocket.OnMessage<T>, WebSocket.OnOpen, WebSocket.OnOpen1, WebSocket.SuccessCallback
BAD_DATA, ERR, GOING_AWAY, KEY, NORMAL, NOT_ACCEPTABLE, POLICY_VIOLATION, PROTOCOL_ERROR, REQUIRED_EXTENSION, SERVER_ERROR, SERVICE_OVERLOAD, SERVICE_RESTARTED, SUCCESS, TOO_BIG_TO_PROCESS
Constructor and Description |
---|
WebSocketImpl(WebSocket.OnOpen handler,
String path,
String pattern,
Map<Object,String> vars,
MediaType consumes,
MediaType produces) |
Modifier and Type | Method and Description |
---|---|
void |
broadcast(Object data,
WebSocket.SuccessCallback success,
WebSocket.OnError err)
Send data to all connected sessions.
|
void |
close(WebSocket.CloseStatus status)
Gracefully closes the connection, after sending a description message
|
void |
connect(com.google.inject.Injector injector,
Request req,
NativeWebSocket ws) |
MediaType |
consumes() |
boolean |
isOpen()
True if the websocket is still open.
|
void |
onClose(WebSocket.OnClose callback)
Register an close callback to execute when client close the web socket.
|
void |
onError(WebSocket.OnError callback)
Register an error callback to execute when an error is found.
|
void |
onMessage(WebSocket.OnMessage<Mutant> callback)
Register a callback to execute when a new message arrive.
|
String |
path() |
String |
pattern() |
void |
pause()
Pause the client stream.
|
MediaType |
produces() |
<T> T |
require(com.google.inject.Key<T> key)
Request a service of the given key.
|
void |
resume()
Resume the client stream.
|
void |
send(Object data,
WebSocket.SuccessCallback success,
WebSocket.OnError err)
Send data through the connection.
|
void |
terminate()
Immediately shuts down the connection.
|
String |
toString() |
Map<Object,String> |
vars() |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
public void close(WebSocket.CloseStatus status)
WebSocket
public void resume()
WebSocket
public void pause()
WebSocket
public void terminate() throws Exception
WebSocket
public boolean isOpen()
WebSocket
public void broadcast(Object data, WebSocket.SuccessCallback success, WebSocket.OnError err) throws Exception
WebSocket
Err
with WebSocket.NORMAL
close status.public void send(Object data, WebSocket.SuccessCallback success, WebSocket.OnError err) throws Exception
WebSocket
Err
with WebSocket.NORMAL
close status.public void onMessage(WebSocket.OnMessage<Mutant> callback) throws Exception
WebSocket
public void connect(com.google.inject.Injector injector, Request req, NativeWebSocket ws)
public String pattern()
public MediaType consumes()
public MediaType produces()
public <T> T require(com.google.inject.Key<T> key)
Registry
public void onError(WebSocket.OnError callback)
WebSocket
public void onClose(WebSocket.OnClose callback) throws Exception
WebSocket
Copyright © 2017. All rights reserved.