public class WebSocketConnection extends Object implements InternalConnection, WebSocketListener
| Constructor and Description |
|---|
WebSocketConnection(String url,
long activityTimeout,
long pongTimeout,
Factory factory) |
| Modifier and Type | Method and Description |
|---|---|
void |
bind(ConnectionState state,
ConnectionEventListener eventListener)
Bind to connection events.
|
void |
connect()
No need to call this via the API.
|
void |
disconnect() |
String |
getSocketId()
Gets a unique connection ID.
|
ConnectionState |
getState()
Gets the current connection state.
|
void |
onClose(int code,
String reason,
boolean remote) |
void |
onError(Exception ex) |
void |
onMessage(String message) |
void |
onOpen(org.java_websocket.handshake.ServerHandshake handshakedata) |
void |
sendMessage(String message) |
boolean |
unbind(ConnectionState state,
ConnectionEventListener eventListener)
Unbind from connection state changes.
|
public WebSocketConnection(String url, long activityTimeout, long pongTimeout, Factory factory) throws URISyntaxException
URISyntaxExceptionpublic void connect()
ConnectionPusher.connect().connect in interface Connectionpublic void disconnect()
disconnect in interface InternalConnectionpublic void bind(ConnectionState state, ConnectionEventListener eventListener)
Connectionbind in interface Connectionstate - The states to bind to.eventListener - A listener to be called when the state changes.public boolean unbind(ConnectionState state, ConnectionEventListener eventListener)
Connectionunbind in interface Connectionstate - The state to unbind from.eventListener - The listener to be unbound.true if the unbind was successful, otherwise
false.public ConnectionState getState()
ConnectiongetState in interface Connectionpublic void sendMessage(String message)
sendMessage in interface InternalConnectionpublic String getSocketId()
ConnectiongetSocketId in interface Connectionpublic void onOpen(org.java_websocket.handshake.ServerHandshake handshakedata)
onOpen in interface WebSocketListenerpublic void onMessage(String message)
onMessage in interface WebSocketListenerpublic void onClose(int code,
String reason,
boolean remote)
onClose in interface WebSocketListenerpublic void onError(Exception ex)
onError in interface WebSocketListenerCopyright © 2016 Pusher. All rights reserved.