|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
Object
Channel
public class Channel
This class represents messaging channel. Channel offers no persistence, it merely performs as communication hub.
After the channel has been initially obtained it is on OPENED state.
At the opened state it can be either joined or closed. At this state
the member list represents the set of members at the time of opening.
After channel has been joined with join(Value, int, MemberCallback, MessageCallback) method it is on JOINED state.
At the joined state it can be left or closed. At this state the member list
is "live" and will be updated when necessary. The MemberCallback is used to notify
the changes to widget.
When channel is closed with close() method it is no longer useable and new
instance must be obtained.
openChannel(String, ChannelCallback),
openChannel(String, String, Value, int, ChannelCallback),
openPrivateChannel(String, Value, int, ChannelCallback)| Method Summary | |
|---|---|
void |
broadcast(String command,
Value argument)
Broadcast a message to all participants on this channel. |
void |
close()
Closes this channel. |
Value |
getInfo()
Returns the free info structure associated with this channel. |
Member |
getMember()
Returns the member representing this widget's membership on the channel. |
Member |
getMember(String id)
Returns the member with specified id. |
List |
getMembers()
Returns the list of members on this channel. |
String |
getName()
Returns the name of channel. |
String |
getProtocol()
Returns the name of "protocol" used on this channel. |
void |
join(Value info,
int timeout,
MemberCallback memberCallback,
MessageCallback messageCallback)
Joins this channel, updating the member list. |
void |
leave()
Leaves this channel. |
void |
setInfo(Value info)
Sets new info structure for this channel. |
void |
update(Value info)
Sets info structure of Member representing this widget instance. |
| Methods inherited from class Object |
|---|
toString, equals, hashCode |
| Methods inherited from |
|---|
equals, getClass, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public String getName()
public String getProtocol()
public Value getInfo()
public void setInfo(Value info)
info - New context dependent info structure.public List getMembers()
Members.public Member getMember()
null if channel hasn't been joined yet.public Member getMember(String id)
id - Member id
null if there is no such member.
public void broadcast(String command,
Value argument)
command - Name of commandargument - Command argument
public void join(Value info,
int timeout,
MemberCallback memberCallback,
MessageCallback messageCallback)
info - Free info structure this membertimeout - Timeout in seconds after which this member will be removed if client has gone offline.
Note that actual effective timeout can be slightly larger than number provided here.memberCallback - Callback for handling the changes on membershipmessageCallback - Callback for handling the incoming messagespublic void update(Value info)
Member representing this widget instance.
Change will be notified to all channel participants. Channel must be
joined before using the operation.
info - Info structurepublic void leave()
public void close()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||