Package org.vrspace.client
Class VRSpaceClient
java.lang.Object
org.vrspace.client.VRSpaceClient
- All Implemented Interfaces:
Runnable
,WebSocket.Listener
A simple vrspace websocket client.
- Author:
- joe
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddEventListener
(Function<VREvent, Void> listener) Add event listener to receive events from the server; an event is either a Command or change to a VRObjectaddMessageListener
(Function<String, Void> listener) Add a listener that receives all text messages from the serveraddWelcomeListener
(Function<Welcome, Void> listener) Welcome messages are received after connecting and entering a worldvoid
await()
Hack, awaits for welcome messageconnect()
void
connectAndEnter
(String world) void
connectAndEnter
(String world, Map<String, String> params) void
Enter a worldint
void
void
onPing
(WebSocket webSocket, ByteBuffer message) onText
(WebSocket webSocket, CharSequence data, boolean last) void
run()
void
Send a json string to the servervoid
send
(ClientRequest req) Send a requestvoid
Send a commandvoid
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.net.http.WebSocket.Listener
onBinary, onPong
-
Field Details
-
TIMEOUT
public static final long TIMEOUT- See Also:
-
RETRY
public static final long RETRY- See Also:
-
-
Constructor Details
-
VRSpaceClient
-
-
Method Details
-
connect
-
startSession
public void startSession() -
connectAndEnter
-
connectAndEnter
-
run
public void run() -
addEventListener
Add event listener to receive events from the server; an event is either a Command or change to a VRObject -
addMessageListener
Add a listener that receives all text messages from the server -
addWelcomeListener
Welcome messages are received after connecting and entering a world -
await
public void await()Hack, awaits for welcome message -
getClient
-
enter
Enter a world -
send
Send a json string to the server -
send
Send a request -
send
Send a command -
getErrorCount
public int getErrorCount() -
onOpen
- Specified by:
onOpen
in interfaceWebSocket.Listener
-
onText
- Specified by:
onText
in interfaceWebSocket.Listener
-
onError
- Specified by:
onError
in interfaceWebSocket.Listener
-
onPing
- Specified by:
onPing
in interfaceWebSocket.Listener
-
onClose
- Specified by:
onClose
in interfaceWebSocket.Listener
-