public class ClientInstance extends Object
Modifier and Type | Field and Description |
---|---|
static boolean |
DEBUG
Debug mode, very verbose output.
|
Constructor and Description |
---|
ClientInstance(PropFactory propFactory,
String host,
int port,
String wsURI,
SSLCommProps sslProps,
IClientInstanceListener clientListener)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
connect()
Connects to the WebSocket URI with or without SSL.
|
void |
connect(boolean noTimeouts)
Connects to the WebSocket URI with or without SSL.
|
boolean |
dispose()
Disposes of this instance and closes the communication session (if opened).
|
String |
getInfoString()
Gets the info string of this session.
|
String |
getState()
Gets the state as a String.
|
boolean |
isConnected()
Checks if connected.
|
boolean |
isDisconnected()
Checks if disconnected.
|
void |
sendBinaryData(int id,
String descr,
byte[] data)
Sends a block of binary data to the remote party.
|
String |
toString()
The String representation as "host:port - description".
|
public ClientInstance(PropFactory propFactory, String host, int port, String wsURI, SSLCommProps sslProps, IClientInstanceListener clientListener) throws IOException, UnrecoverableKeyException, KeyManagementException, NoSuchAlgorithmException, CertificateException, KeyStoreException, NoSuchProviderException
propFactory
- The property factory.host
- The host name or address.port
- The port number.wsURI
- The relative WebSocket URI starting with "/" (normally ending with .ws [unsecure] or .wss [secure]).sslProps
- The SSL properties, null for not secure.clientListener
- The client listener.IOException
- For I/O errors.NoSuchProviderException
KeyStoreException
CertificateException
NoSuchAlgorithmException
KeyManagementException
UnrecoverableKeyException
public boolean isConnected()
public boolean isDisconnected()
public String getState()
public void connect() throws IOException
IllegalStateException
- If already connected or connecting.IOException
- For communication problems.public void connect(boolean noTimeouts) throws IOException
noTimeouts
- Connect with debug = no timeouts! This way we can set breakpoints in Eclipse.IllegalStateException
- If already connected or connecting.IOException
- For communication problems.public boolean dispose()
public void sendBinaryData(int id, String descr, byte[] data) throws IOException
id
- The ID of the reply local ID for error or success reply.descr
- Short description of the data.data
- The data.EOFException
- If connection is closed.IOException
- For send failures.public String getInfoString()
SessionInfo.getConnectionIDString(info)
.iizi® is a registered trademark of Mindus SARL. © Copyright Mindus SARL, 2020. All rights reserved.