public class PolygonWebsocketClient extends java.lang.Object implements WebsocketClient
PolygonWebsocketClient
.Constructor and Description |
---|
PolygonWebsocketClient(java.lang.String keyId,
java.lang.String websocketURL)
Instantiates a new
PolygonWebsocketClient . |
Modifier and Type | Method and Description |
---|---|
void |
addListener(StreamListener<?,?> listener)
Adds a listener.
|
void |
connect()
Connects.
|
void |
disconnect()
Disconnects.
|
void |
handleResubscribing()
Handle resubscribing.
|
void |
handleWebsocketMessage(java.lang.String message)
Handle websocket message.
|
boolean |
isAuthenticated()
Returns true if the websocket is authenticated.
|
boolean |
isConnected()
Returns true if the websocket is connected.
|
void |
removeListener(StreamListener<?,?> listener)
Remove listener.
|
void |
sendAuthenticationMessage()
Send authentication message.
|
void |
sendStreamMessageToListeners(StreamMessageType streamMessageType,
StreamMessage streamMessage)
Send stream message to listeners.
|
public PolygonWebsocketClient(java.lang.String keyId, java.lang.String websocketURL)
PolygonWebsocketClient
.keyId
- the key idwebsocketURL
- the websocket urlpublic void addListener(StreamListener<?,?> listener) throws WebsocketException
WebsocketClient
addListener
in interface WebsocketClient
listener
- the stream listenerWebsocketException
- the WebsocketExceptionpublic void removeListener(StreamListener<?,?> listener) throws WebsocketException
WebsocketClient
removeListener
in interface WebsocketClient
listener
- the stream listenerWebsocketException
- the WebsocketExceptionpublic void connect() throws java.net.URISyntaxException, java.io.IOException, javax.websocket.DeploymentException
WebsocketClient
connect
in interface WebsocketClient
java.net.URISyntaxException
java.io.IOException
javax.websocket.DeploymentException
public void disconnect() throws java.lang.Exception
WebsocketClient
disconnect
in interface WebsocketClient
java.lang.Exception
- the Exceptionpublic void sendAuthenticationMessage()
WebsocketClient
sendAuthenticationMessage
in interface WebsocketClient
public void handleResubscribing()
WebsocketClient
handleResubscribing
in interface WebsocketClient
public void handleWebsocketMessage(java.lang.String message)
WebsocketClient
handleWebsocketMessage
in interface WebsocketClient
message
- the messagepublic void sendStreamMessageToListeners(StreamMessageType streamMessageType, StreamMessage streamMessage)
WebsocketClient
sendStreamMessageToListeners
in interface WebsocketClient
streamMessageType
- the stream message typestreamMessage
- the stream messagepublic boolean isConnected()
WebsocketClient
isConnected
in interface WebsocketClient
public boolean isAuthenticated()
WebsocketClient
isAuthenticated
in interface WebsocketClient