protected class DefaultServer.Connection extends java.lang.Object implements HostedConnection
CHANNEL_DEFAULT_RELIABLE, CHANNEL_DEFAULT_UNRELIABLE
Constructor and Description |
---|
Connection(int channelCount) |
Modifier and Type | Method and Description |
---|---|
java.util.Set<java.lang.String> |
attributeNames()
Returns a read-only set of attribute names currently stored
for this client session.
|
void |
close(java.lang.String reason)
Closes and removes this connection from the server
sending the optional reason to the remote client.
|
protected void |
closeConnection() |
java.lang.String |
getAddress()
Returns the transport specific remote address of this connection
as a string.
|
<T> T |
getAttribute(java.lang.String name)
Retrieves a previously stored session attribute or
null if no such attribute exists.
|
int |
getId()
Returns the server-unique ID for this client.
|
Server |
getServer()
Returns the Server instance that is hosting this connection.
|
void |
send(int channel,
Message message)
Sends a message to the other end of the connection using
the specified alternate channel.
|
void |
send(Message message)
Sends a message to the other end of the connection.
|
java.lang.Object |
setAttribute(java.lang.String name,
java.lang.Object value)
Sets a session attribute specific to this connection.
|
java.lang.String |
toString() |
public Server getServer()
HostedConnection
getServer
in interface HostedConnection
public int getId()
HostedConnection
getId
in interface HostedConnection
public java.lang.String getAddress()
HostedConnection
getAddress
in interface HostedConnection
public void send(Message message)
MessageConnection
send
in interface MessageConnection
public void send(int channel, Message message)
MessageConnection
send
in interface MessageConnection
protected void closeConnection()
public void close(java.lang.String reason)
HostedConnection
close
in interface HostedConnection
public java.lang.Object setAttribute(java.lang.String name, java.lang.Object value)
HostedConnection
setAttribute
in interface HostedConnection
public <T> T getAttribute(java.lang.String name)
HostedConnection
getAttribute
in interface HostedConnection
public java.util.Set<java.lang.String> attributeNames()
HostedConnection
attributeNames
in interface HostedConnection
public java.lang.String toString()
toString
in class java.lang.Object