public class InteractiveWebSocketClient
extends org.java_websocket.client.WebSocketClient
GameClient that owns this connection. Messages sent/received to/from the Interactive service are sent
in the current compression scheme set for the client.| Constructor and Description |
|---|
InteractiveWebSocketClient(GameClient gameClient,
URI uri,
String token,
Number projectVersionId)
Initialize a new
InteractiveWebSocketClient. |
InteractiveWebSocketClient(GameClient gameClient,
URI uri,
String token,
Number projectVersionId,
String shareCode)
Initialize a new
InteractiveWebSocketClient. |
| Modifier and Type | Method and Description |
|---|---|
int |
claimNextPacketId()
Retrieves the next available packet id, then increments the internal counter to reflect that the previous id
has now been allocated.
|
CompressionScheme |
getCompressionScheme()
Retrieves the
CompressionScheme this InteractiveWebSocketClient is using. |
CompletableFuture<Boolean> |
getConnectionPromise()
Returns the
CompletableFuture promise holding the result of a connection attempt using this
websocket client. |
int |
getLastSequenceNumber()
Returns the sequence number that the socket has last seen from the service.
|
ConcurrentMap<Integer,CompletableFuture<ReplyPacket>> |
getWaitingFuturesMap()
Retrieves the
ConcurrentMap of waiting CompletableFuture promises and the IDs for the
packets that made the request. |
void |
onClose(int code,
String reason,
boolean closedRemotely) |
void |
onError(Exception ex) |
void |
onMessage(ByteBuffer bytes) |
void |
onMessage(String message) |
void |
onOpen(org.java_websocket.handshake.ServerHandshake serverHandshake) |
void |
send(String message) |
void |
setCompressionScheme(CompressionScheme compressionScheme)
Sets the
CompressionScheme that this InteractiveWebSocketClient will use. |
void |
setCompressionScheme(String compressionScheme)
Sets the
CompressionScheme that this InteractiveWebSocketClient will use. |
CompletableFuture<Boolean> |
setConnectionPromise(CompletableFuture<Boolean> connectionPromise)
Sets the
CompletableFuture promise holding the result of a connection attempt using this
websocket client. |
close, close, close, closeBlocking, closeConnection, connect, connectBlocking, connections, getConnection, getDraft, getLocalSocketAddress, getLocalSocketAddress, getReadyState, getRemoteSocketAddress, getRemoteSocketAddress, getResourceDescriptor, getSocket, getURI, hasBufferedData, isClosed, isClosing, isConnecting, isFlushAndClose, isOpen, onCloseInitiated, onClosing, onFragment, onWebsocketClose, onWebsocketCloseInitiated, onWebsocketClosing, onWebsocketError, onWebsocketMessage, onWebsocketMessage, onWebsocketMessageFragment, onWebsocketOpen, onWriteDemand, run, send, send, sendFragmentedFrame, sendFrame, sendPing, setProxy, setSocketgetConnectionLostTimeout, isTcpNoDelay, setConnectionLostTimeout, setTcpNoDelay, startConnectionLostTimer, stopConnectionLostTimerpublic InteractiveWebSocketClient(GameClient gameClient, URI uri, String token, Number projectVersionId)
InteractiveWebSocketClient.gameClient - The GameClient that owns this websocket clienturi - The URI address for the InteractiveHost to connect totoken - Authorization token. Can be either an OAuth Bearer token or a xtokenprojectVersionId - The project version ID for the Interactive integration to connect topublic InteractiveWebSocketClient(GameClient gameClient, URI uri, String token, Number projectVersionId, String shareCode)
InteractiveWebSocketClient.gameClient - The GameClient that owns this websocket clienturi - The URI address for the InteractiveHost to connect totoken - Authorization token. Can be either an OAuth Bearer token or a xtokenprojectVersionId - The project version ID for the Interactive integration to connect toshareCode - The share code provided by the author of the Interactive integrationpublic ConcurrentMap<Integer,CompletableFuture<ReplyPacket>> getWaitingFuturesMap()
ConcurrentMap of waiting CompletableFuture promises and the IDs for the
packets that made the request.ConcurrentMap of waiting CompletableFuture promises and the IDs for the
packets that made the requestpublic CompletableFuture<Boolean> getConnectionPromise()
CompletableFuture promise holding the result of a connection attempt using this
websocket client.CompletableFuture promise holding the result of a connection attempt using this
websocket client.public CompletableFuture<Boolean> setConnectionPromise(CompletableFuture<Boolean> connectionPromise)
CompletableFuture promise holding the result of a connection attempt using this
websocket client.connectionPromise - The CompletableFuture promise holding the result of a connection attempt using this
websocket client.CompletableFuture promise holding the result of a connection attempt using this
websocket client.public int claimNextPacketId()
public int getLastSequenceNumber()
public CompressionScheme getCompressionScheme()
CompressionScheme this InteractiveWebSocketClient is using.CompressionScheme this InteractiveWebSocketClient is usingpublic void setCompressionScheme(String compressionScheme)
CompressionScheme that this InteractiveWebSocketClient will use.compressionScheme - The compression scheme that this InteractiveWebSocketClient will usepublic void setCompressionScheme(CompressionScheme compressionScheme)
CompressionScheme that this InteractiveWebSocketClient will use.compressionScheme - CompressionScheme that this InteractiveWebSocketClient will usepublic void onOpen(org.java_websocket.handshake.ServerHandshake serverHandshake)
onOpen in class org.java_websocket.client.WebSocketClientserverHandshake - The handshake returned by the Interactive serviceWebSocketClient.onOpen(ServerHandshake)public void send(String message)
send in interface org.java_websocket.WebSocketsend in class org.java_websocket.client.WebSocketClientmessage - The message to send to the Interactive serviceWebSocketClient.send(String)public void onMessage(ByteBuffer bytes)
onMessage in class org.java_websocket.client.WebSocketClientbytes - ByteBuffer containing message received from the Interactive service (as an array of bytes)WebSocketClient.onMessage(ByteBuffer)public void onMessage(String message)
onMessage in class org.java_websocket.client.WebSocketClientmessage - The message received from the Interactive serviceWebSocketClient.onMessage(String)public void onClose(int code,
String reason,
boolean closedRemotely)
onClose in class org.java_websocket.client.WebSocketClientcode - HTTP status codereason - HTTP status reasonclosedRemotely - true if the connection was closed remotely, false otherwiseWebSocketClient.onClose(int, String, boolean)public void onError(Exception ex)
onError in class org.java_websocket.client.WebSocketClientex - The Exception thrown when the WebSocketClient connection erroredWebSocketClient.onError(Exception)Copyright © 2018. All rights reserved.