Package dev.gmitch215.bytebox.socket
Class WebSocketPair
java.lang.Object
dev.gmitch215.bytebox.socket.WebSocketPair
The two ends of a WebSocket the Worker itself creates.
Accepting a connection means making a pair, keeping the server end, and answering the request with the client end and status 101. The client end is never used from Java: it goes back to whoever asked.
WebSocketPair pair = WebSocketPair.create();
state.acceptWebSocket(pair.server());
return Bytebox.upgrade(pair.client());
- Since:
- 1.0.0
-
Method Summary
-
Method Details
-
create
Returns a new pair.- Returns:
- a new pair
-
client
Returns the end that goes back to the client, in a 101 response.- Returns:
- the end that goes back to the client, in a 101 response
-
server
Returns the end this Worker keeps.- Returns:
- the end this Worker keeps
-