public interface IWebSocketComm
Modifier and Type | Method and Description |
---|---|
boolean |
areBinaryDataFramesSupported()
Checks if Binary Data Frames are supported.
|
void |
close()
Call this method to close the socket.
|
boolean |
close(boolean rightNow)
Call this method to close the socket.
|
void |
close(int code,
String reason)
Call this method to close the socket.
|
Object |
getAttachment()
Gets the WebSocket attachment object, null for none.
|
String |
getDomain()
Gets the request domain.
|
int |
getPort()
Gets the port number for the connection to the server.
|
String |
getRemoteAddr()
Returns the Internet Protocol (IP) address of the client or last proxy that sent the request.
|
String |
getRemoteHost()
Returns the fully qualified name of the client or the last proxy that sent the request.
|
InetSocketAddress |
getSocketAddress()
Returns the remote address to which this channel's socket is connected.
|
String |
getSubProtocol()
Gets the negotiated and accepted sub-protocol, null for none (yet), or none
is provided by the parties (server or client).
|
boolean |
isClosed()
Checks if the connection is disposed of.
|
boolean |
isClosing()
Checks if the connection is currently closing.
|
boolean |
isConnected()
Checks if the connection is established.
|
boolean |
isConnecting()
Checks if the connection is connecting.
|
boolean |
isSecure()
Return if the connection is secured using SSL/TLS.
|
void |
send(byte[] data)
Sends binary data.
|
void |
send(String data)
Sends a String of data.
|
boolean |
sendHeartBeat()
Sends a heart-beat.
|
void |
setAttachment(Object attachment)
Gets the WebSocket attachment object, null for none.
|
void |
setSubProtocol(String subProtocol)
Assigns a sub-protocol for the WebSocket (in case the processing of sub-protocol
negotiation is done e.g.
|
boolean isConnecting()
boolean isConnected()
boolean isClosing()
boolean isClosed()
void close()
void close(int code, String reason)
code
- A close code: zero for none, otherwise a code 1000 or range 4000 to 4999.reason
- The reason code, can be null.boolean close(boolean rightNow)
rightNow
- If true, the socket is hard-closed,
i.e. no close conversation takes place with the server.
If false, the client will send a close message to server
that replies with a close itself, then the socket is closed.void setSubProtocol(String subProtocol) throws IllegalStateException
IllegalStateException
- If the state doesn't permit this operation, or if the
implementation doesn't allow it.String getSubProtocol()
boolean areBinaryDataFramesSupported()
void send(byte[] data) throws IOException
data
- The byte array containing the data.IOException
- for failures, e.g. socket is closed, not open, not connected.void send(String data) throws IOException
data
- The String to send.IOException
- for failures, e.g. socket is closed, not open, not connected.boolean sendHeartBeat() throws IOException
IOException
- For send failures.String getDomain()
int getPort()
boolean isSecure()
String getRemoteAddr()
String getRemoteHost()
InetSocketAddress getSocketAddress()
Where the channel is bound and connected to an Internet Protocol
socket address then the return value from this method is of type InetSocketAddress
.
null
if the channel's socket is not connected.Object getAttachment()
setAttachment
.void setAttachment(Object attachment)
attachment
- The attachment object for the web socket.iizi® is a registered trademark of Mindus SARL. © Copyright Mindus SARL, 2020. All rights reserved.