public class Socket
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
class |
Socket.PhoenixWSListener |
| Modifier and Type | Field and Description |
|---|---|
static int |
RECONNECT_INTERVAL_MS |
| Constructor and Description |
|---|
Socket(java.lang.String endpointUri) |
Socket(java.lang.String endpointUri,
int heartbeatIntervalInMs) |
| Modifier and Type | Method and Description |
|---|---|
Channel |
chan(java.lang.String topic,
com.fasterxml.jackson.databind.JsonNode payload)
Retrieve a channel instance for the specified topic
|
void |
connect() |
void |
disconnect() |
boolean |
isConnected() |
Socket |
onClose(ISocketCloseCallback callback)
Register a callback for SocketEvent.ERROR events
|
Socket |
onError(IErrorCallback callback)
Register a callback for SocketEvent.ERROR events
|
Socket |
onMessage(IMessageCallback callback)
Register a callback for SocketEvent.MESSAGE events
|
Socket |
onOpen(ISocketOpenCallback callback)
Register a callback for SocketEvent.OPEN events
|
Socket |
push(Envelope envelope)
Sends a message envelope on this socket
|
void |
reconectOnFailure(boolean reconnectOnFailure)
Should the socket attempt to reconnect if websocket.onFailure is called.
|
void |
remove(Channel channel)
Removes the specified channel if it is known to the socket
|
void |
removeAllChannels() |
java.lang.String |
toString() |
public static final int RECONNECT_INTERVAL_MS
public Socket(java.lang.String endpointUri)
throws java.io.IOException
java.io.IOExceptionpublic Socket(java.lang.String endpointUri,
int heartbeatIntervalInMs)
public Channel chan(java.lang.String topic, com.fasterxml.jackson.databind.JsonNode payload)
topic - The channel topicpayload - The message payloadpublic void connect()
throws java.io.IOException
java.io.IOExceptionpublic void disconnect()
throws java.io.IOException
java.io.IOExceptionpublic boolean isConnected()
public Socket onClose(ISocketCloseCallback callback)
callback - The callback to receive CLOSE eventspublic Socket onError(IErrorCallback callback)
callback - The callback to receive ERROR eventspublic Socket onMessage(IMessageCallback callback)
callback - The callback to receive MESSAGE eventspublic Socket onOpen(ISocketOpenCallback callback)
callback - The callback to receive OPEN eventspublic Socket push(Envelope envelope) throws java.io.IOException
envelope - The message envelopejava.io.IOException - Thrown if the message cannot be sentpublic void reconectOnFailure(boolean reconnectOnFailure)
reconnectOnFailure - reconnect valuepublic void remove(Channel channel)
channel - The channel to be removedpublic void removeAllChannels()
public java.lang.String toString()
toString in class java.lang.Object