Class WebSocketClientEndpoint
- java.lang.Object
-
- jakarta.websocket.Endpoint
-
- de.kosmos_lab.web.client.websocket.WebSocketClientEndpoint
-
public class WebSocketClientEndpoint extends jakarta.websocket.Endpoint
-
-
Field Summary
Fields Modifier and Type Field Description protected WebSocketClientclientprotected HashMap<Integer,WebSocketEventConsumer>consumersCountDownLatchinitLatchprotected jakarta.websocket.Sessionsessionprotected booleanstopped
-
Constructor Summary
Constructors Constructor Description WebSocketClientEndpoint(WebSocketClient webSocketClient)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConsumer(int id, WebSocketEventConsumer consumer)ObjectgetVar(String name)org.json.JSONObjectgetVars()booleanisAuthed()booleanisStopped()voidonClose(jakarta.websocket.Session session, jakarta.websocket.CloseReason closeReason)voidonMessageReceived(String message)voidonOpen(jakarta.websocket.Session session, jakarta.websocket.EndpointConfig endpointConfig)voidsend(String text)sends the given text to the EndpointvoidsendCommand(org.json.JSONObject command, WebSocketEventConsumer consumer)voidsetVar(String name, Object value)voidstop()booleanwaitForValue(String key, Object expected, long waittime)
-
-
-
Field Detail
-
client
protected final WebSocketClient client
-
initLatch
public CountDownLatch initLatch
-
stopped
protected boolean stopped
-
session
protected jakarta.websocket.Session session
-
consumers
protected final HashMap<Integer,WebSocketEventConsumer> consumers
-
-
Constructor Detail
-
WebSocketClientEndpoint
public WebSocketClientEndpoint(WebSocketClient webSocketClient)
-
-
Method Detail
-
isStopped
public boolean isStopped()
-
addConsumer
public void addConsumer(int id, WebSocketEventConsumer consumer)
-
getVars
public org.json.JSONObject getVars()
-
isAuthed
public boolean isAuthed()
-
onClose
public void onClose(jakarta.websocket.Session session, jakarta.websocket.CloseReason closeReason)- Overrides:
onClosein classjakarta.websocket.Endpoint
-
onMessageReceived
public void onMessageReceived(String message)
-
onOpen
public void onOpen(jakarta.websocket.Session session, jakarta.websocket.EndpointConfig endpointConfig)- Specified by:
onOpenin classjakarta.websocket.Endpoint
-
send
public void send(String text) throws IOException
sends the given text to the Endpoint- Parameters:
text-- Throws:
IOException
-
sendCommand
public void sendCommand(org.json.JSONObject command, WebSocketEventConsumer consumer)
-
stop
public void stop()
-
-