public class MuxChannel extends Object implements LogicalConnection, IncomingFrames, SuspendToken, IOState.ConnectionStateListener
| Constructor and Description |
|---|
MuxChannel(long channelId,
Muxer muxer) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Send a websocket Close frame, without a status code or reason.
|
void |
close(int statusCode,
String reason)
Send a websocket Close frame, with status code.
|
void |
disconnect()
Terminate the connection (no close frame sent)
|
long |
getChannelId() |
IOState |
getIOState()
Get the IOState of the connection.
|
InetSocketAddress |
getLocalAddress()
Get the local
InetSocketAddress in use for this connection. |
long |
getMaxIdleTimeout()
Set the maximum number of milliseconds of idleness before the connection is closed/disconnected, (ie no frames are either sent or received)
|
WebSocketPolicy |
getPolicy()
The policy that the connection is running under.
|
InetSocketAddress |
getRemoteAddress()
Get the remote Address in use for this connection.
|
WebSocketSession |
getSession()
Get the Session for this connection
|
void |
incomingError(WebSocketException e)
Incoming exceptions from Muxer.
|
void |
incomingFrame(Frame frame)
Incoming frames from Muxer
|
boolean |
isActive() |
boolean |
isOpen()
Test if logical connection is still open
|
boolean |
isReading()
Tests if the connection is actively reading.
|
void |
onClose() |
void |
onConnectionStateChange(ConnectionState state) |
void |
onOpen() |
void |
outgoingFrame(Frame frame,
WriteCallback callback)
Frames destined for the Muxer
|
void |
resume() |
void |
setMaxIdleTimeout(long ms)
Set the maximum number of milliseconds of idleness before the connection is closed/disconnected, (ie no frames are either sent or received)
|
void |
setNextIncomingFrames(IncomingFrames incoming)
Set where the connection should send the incoming frames to.
|
void |
setSession(WebSocketSession session)
Set the session associated with this connection
|
void |
setSubProtocol(String subProtocol) |
SuspendToken |
suspend()
Suspend a the incoming read events on the connection.
|
public MuxChannel(long channelId,
Muxer muxer)
public void close()
LogicalConnectionBasic usage: results in an non-blocking async write, then connection close.
close in interface LogicalConnectionStatusCode,
LogicalConnection.close(int, String)public void close(int statusCode,
String reason)
LogicalConnectionAdvanced usage: results in an non-blocking async write, then connection close.
close in interface LogicalConnectionstatusCode - the status codereason - the (optional) reason. (can be null for no reason)StatusCodepublic void disconnect()
LogicalConnectiondisconnect in interface LogicalConnectionpublic long getChannelId()
public IOState getIOState()
LogicalConnectiongetIOState in interface LogicalConnectionpublic InetSocketAddress getLocalAddress()
LogicalConnectionInetSocketAddress in use for this connection.
Note: Non-physical connections, like during the Mux extensions, or during unit testing can result in a InetSocketAddress on port 0 and/or on localhost.
getLocalAddress in interface LogicalConnectionpublic long getMaxIdleTimeout()
LogicalConnectiongetMaxIdleTimeout in interface LogicalConnectionpublic WebSocketPolicy getPolicy()
LogicalConnectiongetPolicy in interface LogicalConnectionpublic InetSocketAddress getRemoteAddress()
LogicalConnectionNote: Non-physical connections, like during the Mux extensions, or during unit testing can result in a InetSocketAddress on port 0 and/or on localhost.
getRemoteAddress in interface LogicalConnectionpublic WebSocketSession getSession()
LogicalConnectiongetSession in interface LogicalConnectionpublic void incomingError(WebSocketException e)
incomingError in interface IncomingFramespublic void incomingFrame(Frame frame)
incomingFrame in interface IncomingFramespublic boolean isActive()
public boolean isOpen()
LogicalConnectionisOpen in interface LogicalConnectionpublic boolean isReading()
LogicalConnectionisReading in interface LogicalConnectionpublic void onClose()
public void onConnectionStateChange(ConnectionState state)
onConnectionStateChange in interface IOState.ConnectionStateListenerpublic void onOpen()
public void outgoingFrame(Frame frame, WriteCallback callback)
outgoingFrame in interface OutgoingFramespublic void resume()
resume in interface SuspendTokenpublic void setMaxIdleTimeout(long ms)
LogicalConnectionsetMaxIdleTimeout in interface LogicalConnectionms - the number of milliseconds of idle timeoutpublic void setNextIncomingFrames(IncomingFrames incoming)
LogicalConnectionOften this is from the Parser to the start of the extension stack, and eventually on to the session.
setNextIncomingFrames in interface LogicalConnectionincoming - the incoming frames handlerpublic void setSession(WebSocketSession session)
LogicalConnectionsetSession in interface LogicalConnectionsession - the sessionpublic void setSubProtocol(String subProtocol)
public SuspendToken suspend()
LogicalConnectionsuspend in interface LogicalConnectionCopyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.