public class WebSocketHelper extends Object
| Constructor and Description |
|---|
WebSocketHelper() |
WebSocketHelper(Long asyncTimeout)
Creates a helper object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
sendBasicMessageAsync(Collection<javax.websocket.Session> sessions,
BasicMessage msg)
Converts the given message to JSON and sends that JSON text to clients asynchronously.
|
void |
sendBasicMessageAsync(javax.websocket.Session session,
BasicMessage msg) |
void |
sendBasicMessageSync(Collection<javax.websocket.Session> sessions,
BasicMessage msg)
Converts the given message to JSON and sends that JSON text to clients synchronously.
|
void |
sendBasicMessageSync(javax.websocket.Session session,
BasicMessage msg) |
void |
sendTextAsync(Collection<javax.websocket.Session> sessions,
String text)
Sends text to clients asynchronously.
|
void |
sendTextAsync(javax.websocket.Session session,
String text) |
void |
sendTextSync(Collection<javax.websocket.Session> sessions,
String text)
Sends text to clients synchronously.
|
void |
sendTextSync(javax.websocket.Session session,
String text) |
public WebSocketHelper()
public WebSocketHelper(Long asyncTimeout)
timeout - number of milliseconds before an asynchronous send will timeout.
A negative number means no timeout, null means use the WebSocket default timeout.public void sendBasicMessageAsync(Collection<javax.websocket.Session> sessions, BasicMessage msg)
sessions - the client sessions where the JSON message will be sentmsg - the message to be converted to JSON and sentpublic void sendBasicMessageSync(Collection<javax.websocket.Session> sessions, BasicMessage msg) throws IOException
sessions - the client sessions where the message will be sentmsg - the message to be converted to JSON and sentIOException - if a problem occurred during delivery of the message to a session.public void sendTextAsync(Collection<javax.websocket.Session> sessions, String text)
sessions - the client sessions where the message will be senttext - the messagepublic void sendTextSync(Collection<javax.websocket.Session> sessions, String text) throws IOException
sessions - the client sessions where the message will be senttext - the messageIOException - if a problem occurred during delivery of the message to a session.public void sendBasicMessageAsync(javax.websocket.Session session,
BasicMessage msg)
public void sendBasicMessageSync(javax.websocket.Session session,
BasicMessage msg)
throws IOException
IOExceptionpublic void sendTextAsync(javax.websocket.Session session,
String text)
public void sendTextSync(javax.websocket.Session session,
String text)
throws IOException
IOExceptionCopyright © 2015 Red Hat, Inc.. All rights reserved.