ConnectivityClient
Interface for connectivity clients. This should be implemented for every supported communications channel.
This provides the client side of a client-server relationship. Zero or more services can be provided by the server side. The client side can subscribe to these services by a ServiceUuid. Every communication service has an associated ServiceUuid, which is unique for that service and is provided as part of the service definition. That same ID should be used here.
For every subscribed service the client can receive connection state information as well as messages through the ConnectivityClientServiceListener interface. It can also send messages for specific services to the server using sendMessage.
Note: That a server can have multiple clients connected for one service, but a client can only be connected to one server.
Note: On this level there is no persistence between connections. When a connection is lost, no state is maintained and it needs to be fully reinitialized when it is reconnected.
Functions
Register the specified listener.
Sends a message with the specified data to the connection with the specified serviceConnectionId for the service with the specified serviceUuid. Returns true
when the message is successfully send, false
when close was already called or there was no connection at the time.
Subscribes to the service with the specified serviceUuid. The specified listener will receive events for the service. Returns true
on success, false
if the service was already subscribed or if close was already called.
Unregister the specified listener.
Unsubscribes from the service with the specified serviceUuid. Returns true
on success, false
if the service was not subscribed.