com.streamhub.api
Interface Client


public interface Client

Represents a client - either a browser (Comet) client or a direct client using one of the thick client SDKs (e.g. .NET or Java).


Method Summary
 void disconnect()
          Disconnects this client.
 Set<String> getSubscriptions()
          Returns a list of every topic the client is currently subscribed to
 String getUid()
          Returns a unique ID for each client
 boolean isConnected()
          Whether this client is currently connected and capable of receiving messages
 void send(String topic, Payload payload)
          Sends a message to this client on a particular topic
 

Method Detail

send

void send(String topic,
          Payload payload)
Sends a message to this client on a particular topic

Note the client does not need to be subscribed to topic but they may choose to ignore the message if they are not. To send a message to all subscribers of a topic use NIOServer.publish(String, Payload)

Parameters:
topic - the topic to send the message with
payload - the contents of the message
See Also:
JsonPayload, Payload

disconnect

void disconnect()
Disconnects this client. The connection will be closed immediately. The subscriptions will be removed after a six minute interval allowing time for the client to reconnect.


isConnected

boolean isConnected()
Whether this client is currently connected and capable of receiving messages

Returns:
true if the client is currently connected, otherwise false

getUid

String getUid()
Returns a unique ID for each client

Returns:
a unique ID for this client

getSubscriptions

Set<String> getSubscriptions()
Returns a list of every topic the client is currently subscribed to

Returns:
the clients current subscriptions


Copyright © 2009 StreamHub. Tutorials, news and guides can be found on the StreamHub Comet Blog.