@WebSocket
public class WebsocketClientEvents
extends java.lang.Object
Constructor and Description |
---|
WebsocketClientEvents(processing.core.PApplet p,
java.lang.reflect.Method event) |
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.CountDownLatch |
getLatch() |
void |
onConnect(org.eclipse.jetty.websocket.api.Session session)
Handling establishment of the connection
|
void |
onError(java.lang.Throwable cause)
Handles errors occurring and writing them to the console
|
void |
onText(org.eclipse.jetty.websocket.api.Session session,
java.lang.String message)
Sending incoming messages to the Processing sketch's websocket event function
|
void |
sendMessage(java.lang.String str)
Sends message to the websocket server
|
public WebsocketClientEvents(processing.core.PApplet p, java.lang.reflect.Method event)
@OnWebSocketMessage public void onText(org.eclipse.jetty.websocket.api.Session session, java.lang.String message) throws java.io.IOException
session
- The connection between server and clientmessage
- The received messagejava.io.IOException
- If no event fonction is registered in the Processing sketch then an exception is thrown, but it will be ignored@OnWebSocketConnect public void onConnect(org.eclipse.jetty.websocket.api.Session session)
session
- The connection between server and clientpublic void sendMessage(java.lang.String str)
str
- The message to send to the server@OnWebSocketError public void onError(java.lang.Throwable cause)
cause
- The cause of an errorpublic java.util.concurrent.CountDownLatch getLatch()