|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ServerSessionListener
A client's listener for handling messages sent from server to client and for handling other connection-related events.
A ServerSessionListener for a client is notified in the
following cases: when the associated client is joined to a channel
(joinedChannel), a message is received from the
server (receivedMessage), a connection with
the server is being re-established (reconnecting),
a connection has been re-established (reconnected),
or finally when the associated server session becomes disconnected,
gracefully or otherwise (disconnected).
If a server session becomes disconnected, it can no longer be used to send messages to the server. In this case, a client must log in again to obtain a new server session to communicate with the server.
| Method Summary | |
|---|---|
void |
disconnected(boolean graceful,
String reason)
Notifies this listener that the associated server session is disconnected. |
ClientChannelListener |
joinedChannel(ClientChannel channel)
Notifies this listener that its associated client has joined the specified channel, and returns a non-null
ClientChannelListener for that channel. |
void |
receivedMessage(ByteBuffer message)
Notifies this listener that the specified message was sent by the server. |
void |
reconnected()
Notifies this listener when the associated server session is successfully reconnected. |
void |
reconnecting()
Notifies this listener that requests to the server must be suspended. |
| Method Detail |
|---|
ClientChannelListener joinedChannel(ClientChannel channel)
channel, and returns a non-null
ClientChannelListener for that channel.
When a message is received on the specified channel, the returned
listener's receivedMessage method is invoked with the specified channel and
the message. The returned listener is notified of messages
that its client sends on the specified channel; that is, a sender
receives its own broadcasts.
When the client associated with this server session leaves the
specified channel, the returned listener's leftChannel method is invoked with
the specified channel.
channel - a channel
null listener for the specified channelvoid receivedMessage(ByteBuffer message)
message - a read-only ByteBuffer containing the messagevoid reconnecting()
Once this method returns, the associated server session should
not send any messages to the server until this listener's reconnected method is invoked. Any messages sent during message
suspension and/or server reconnection are not guaranteed to be
received and/or processed by the server.
If the associated server session is reconnecting and a connection
can be re-established with the server in a timely manner, this
listener's reconnected method will be
invoked. Otherwise, if a connection cannot be re-established, this
listener's disconnected method will be invoked with false indicating that the associated session is disconnected from
the server and the client must log in again.
void reconnected()
void disconnected(boolean graceful,
String reason)
If graceful is true, the disconnection
was due to the associated client gracefully logging out; otherwise,
the disconnection was due to other circumstances, such as forced
disconnection.
Before this method is invoked, it is guaranteed that the listeners
of all ClientChannels with this session as a member will
have their leftChannel
methods invoked.
graceful - true if disconnection was due to the
associated client gracefully logging out, and
false otherwisereason - a string indicating the reason this session was
disconnected, or null if no reason was provided
|
RedDwarf, Version 0.10.0 2010-02-12 09:11:07 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||