public class Muxer extends Object implements IncomingFrames, MuxParser.Listener
Maintains a 1 (incoming and outgoing mux encapsulated frames) to many (per-channel incoming/outgoing standard websocket frames) relationship, along with
routing of MuxControlBlock events.
Control Channel events (channel ID == 0) are handled by the Muxer.
| Constructor and Description |
|---|
Muxer(LogicalConnection connection) |
| Modifier and Type | Method and Description |
|---|---|
MuxAddClient |
getAddClient() |
MuxAddServer |
getAddServer() |
MuxChannel |
getChannel(long channelId,
boolean create) |
WebSocketPolicy |
getPolicy() |
InetSocketAddress |
getRemoteAddress()
Get the remote address of the physical connection.
|
void |
incomingError(WebSocketException e)
Incoming parser errors
|
void |
incomingFrame(Frame frame)
Incoming mux encapsulated frames.
|
boolean |
isOpen()
Is the muxer and the physical connection still open?
|
String |
mergeHeaders(List<String> physicalHeaders,
String deltaHeaders) |
void |
onMuxAddChannelRequest(MuxAddChannelRequest request)
Incoming mux control block, destined for the control channel (id 0)
|
void |
onMuxAddChannelResponse(MuxAddChannelResponse response)
Incoming mux control block, destined for the control channel (id 0)
|
void |
onMuxDropChannel(MuxDropChannel drop)
Incoming mux control block, destined for the control channel (id 0)
|
void |
onMuxedFrame(MuxedFrame frame)
Incoming mux-unwrapped frames, destined for a sub-channel
|
void |
onMuxException(MuxException e) |
void |
onMuxFlowControl(MuxFlowControl flow)
Incoming mux control block, destined for the control channel (id 0)
|
void |
onMuxNewChannelSlot(MuxNewChannelSlot slot)
Incoming mux control block, destined for the control channel (id 0)
|
void |
output(long channelId,
Frame frame,
WriteCallback callback)
Outgoing frame, without mux encapsulated payload.
|
void |
output(MuxControlBlock op)
Write an OP out the physical connection.
|
void |
setAddClient(MuxAddClient addClient) |
void |
setAddServer(MuxAddServer addServer) |
void |
setOutgoingFramesHandler(OutgoingFrames outgoing) |
void |
setRemoteAddress(InetSocketAddress remoteAddress)
Set the remote address of the physical connection.
|
String |
toString() |
public Muxer(LogicalConnection connection)
public MuxAddClient getAddClient()
public MuxAddServer getAddServer()
public MuxChannel getChannel(long channelId, boolean create)
public WebSocketPolicy getPolicy()
public InetSocketAddress getRemoteAddress()
public void incomingError(WebSocketException e)
incomingError in interface IncomingFramespublic void incomingFrame(Frame frame)
incomingFrame in interface IncomingFramespublic boolean isOpen()
public void onMuxAddChannelRequest(MuxAddChannelRequest request)
onMuxAddChannelRequest in interface MuxParser.Listenerpublic void onMuxAddChannelResponse(MuxAddChannelResponse response)
onMuxAddChannelResponse in interface MuxParser.Listenerpublic void onMuxDropChannel(MuxDropChannel drop)
onMuxDropChannel in interface MuxParser.Listenerpublic void onMuxedFrame(MuxedFrame frame)
onMuxedFrame in interface MuxParser.Listenerpublic void onMuxException(MuxException e)
onMuxException in interface MuxParser.Listenerpublic void onMuxFlowControl(MuxFlowControl flow)
onMuxFlowControl in interface MuxParser.Listenerpublic void onMuxNewChannelSlot(MuxNewChannelSlot slot)
onMuxNewChannelSlot in interface MuxParser.Listenerpublic void output(long channelId,
Frame frame,
WriteCallback callback)
public void output(MuxControlBlock op) throws IOException
op - the mux operation to writeIOExceptionpublic void setAddClient(MuxAddClient addClient)
public void setAddServer(MuxAddServer addServer)
public void setOutgoingFramesHandler(OutgoingFrames outgoing)
public void setRemoteAddress(InetSocketAddress remoteAddress)
This address made available to sub-channels.
remoteAddress - the remote addressCopyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.