org.jdesktop.wonderland.server.comms
Interface WonderlandClientSender


public interface WonderlandClientSender

A sender that sends messages to clients connected with the given ConnectionType. The list of clients available with the given type is maintained by the WonderlandSessionListener in response to connect and disconnect requests.

Senders that implement WonderlandClientSender are serializable, and will be valid for as long as a handler is registered for the given client type. If the handler is unregistered, the sender will be closed, and any further attempts to use it will result in an exception.

Author:
jkaplan

Method Summary
 java.util.Set<WonderlandClientID> getClients()
          Get all sessions associated with this sender.
 ConnectionType getClientType()
          Get the client type this channel sends to
 boolean hasSessions()
          Return if there are any sessions associated with this sender.
 void send(com.sun.sgs.app.Channel channel, Message message)
          Send a message to all sessions joined to the given channel.
 void send(Message message)
          Send a message to all session connected via this sender's client type.
 void send(java.util.Set<WonderlandClientID> sessions, Message message)
          Send a message to a set of sessions connected via this sender.
 void send(WonderlandClientID clientID, Message message)
          Send a message to a single session connected via this sender.
 

Method Detail

getClientType

ConnectionType getClientType()
Get the client type this channel sends to

Returns:
the client type

getClients

java.util.Set<WonderlandClientID> getClients()
Get all sessions associated with this sender. This will return a set containing the IDs of all sessions connected with the given type.

To send to a particular client of the given type, use the send(WonderlandClientID, Message) method.

Returns:
a set of session ids that are connected via the given client type.

hasSessions

boolean hasSessions()
Return if there are any sessions associated with this sender.

Returns:
true if this channel has any sessions, or false if not

send

void send(Message message)
Send a message to all session connected via this sender's client type. The message will be handled on each remote client by the WonderlandClient connected with the ConnectionType of this sender.

Parameters:
message - the message to send
Throws:
java.lang.IllegalStateException - if the handler for this client type has been unregistered

send

void send(WonderlandClientID clientID,
          Message message)
Send a message to a single session connected via this sender. The message will be handled by the WonderlandClient connected with the ConnectionType of this channel.

Note that this method does not check whether the given session has connected the client that this channel sends to. If the session does not have an connected client for the given type, the remote client will not be able to process the message.

Parameters:
session - the session to send to
message - the message to send
Throws:
java.lang.IllegalStateException - if the handler for this client type has been unregistered

send

void send(java.util.Set<WonderlandClientID> sessions,
          Message message)
Send a message to a set of sessions connected via this sender. The message will be handled on each remote client by the WonderlandClient connected with the ConnectionType of this channel.

Note that this method does not check whether the given sessions have connected the client that this channel sends to. If the sessions do not have an connected client for the given type, the remote clients will not be able to process the message.

Parameters:
sessions - the sessions to send to
message - the message to send
Throws:
java.lang.IllegalStateException - if the handler for this client type has been unregistered

send

void send(com.sun.sgs.app.Channel channel,
          Message message)
Send a message to all sessions joined to the given channel. The message will be handled on each remote client by the WonderlandClient connected with the ConnectionType of this channel.

Note that this method does not check whether the given sessions have connected the client that this channel sends to. If the sessions do not have an connected client for the given type, the remote clients will not be able to process the message.

Parameters:
sessions - the sessions to send to
message - the message to send
Throws:
java.lang.IllegalStateException - if the handler for this client type has been unregistered


Open Wonderland - http://openwonderland.org