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
Fields -
Constructor Summary
Constructors -
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 worldvoidawait()Hack, awaits for welcome messageconnect()voidconnectAndEnter(String world) voidconnectAndEnter(String world, Map<String, String> params) voidEnter a worldintvoidvoidonPing(WebSocket webSocket, ByteBuffer message) onText(WebSocket webSocket, CharSequence data, boolean last) voidrun()voidSend a json string to the servervoidsend(ClientRequest req) Send a requestvoidSend a commandvoidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
onOpenin interfaceWebSocket.Listener
-
onText
- Specified by:
onTextin interfaceWebSocket.Listener
-
onError
- Specified by:
onErrorin interfaceWebSocket.Listener
-
onPing
- Specified by:
onPingin interfaceWebSocket.Listener
-
onClose
- Specified by:
onClosein interfaceWebSocket.Listener
-