public abstract class AbstractEventDriver extends AbstractLifeCycle implements IncomingFrames, EventDriver
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
Modifier and Type | Field and Description |
---|---|
protected MessageAppender |
activeMessage |
protected WebSocketPolicy |
policy |
protected WebSocketSession |
session |
protected Logger |
TARGET_LOG |
protected Object |
websocket |
Constructor and Description |
---|
AbstractEventDriver(WebSocketPolicy policy,
Object websocket) |
Modifier and Type | Method and Description |
---|---|
protected void |
appendMessage(ByteBuffer buffer,
boolean fin) |
protected void |
dispatch(Runnable runnable) |
protected void |
doStop() |
BatchMode |
getBatchMode() |
WebSocketPolicy |
getPolicy() |
WebSocketSession |
getSession() |
void |
incomingError(Throwable e) |
void |
incomingFrame(Frame frame)
Process the incoming frame.
|
void |
onContinuationFrame(ByteBuffer buffer,
boolean fin) |
void |
onPing(ByteBuffer buffer) |
void |
onPong(ByteBuffer buffer) |
void |
openSession(WebSocketSession session) |
protected void |
terminateConnection(int statusCode,
String rawreason) |
addLifeCycleListener, doStart, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onBinaryFrame, onBinaryMessage, onClose, onConnect, onError, onFrame, onInputStream, onReader, onTextFrame, onTextMessage
protected final Logger TARGET_LOG
protected WebSocketPolicy policy
protected final Object websocket
protected WebSocketSession session
protected MessageAppender activeMessage
public AbstractEventDriver(WebSocketPolicy policy, Object websocket)
protected void appendMessage(ByteBuffer buffer, boolean fin) throws IOException
IOException
protected void dispatch(Runnable runnable)
public WebSocketPolicy getPolicy()
getPolicy
in interface EventDriver
public WebSocketSession getSession()
getSession
in interface EventDriver
public final void incomingError(Throwable e)
incomingError
in interface IncomingFrames
public void incomingFrame(Frame frame)
IncomingFrames
Note: if you need to hang onto any information from the frame, be sure to copy it, as the information contained in the Frame will be released and/or reused by the implementation.
incomingFrame
in interface IncomingFrames
frame
- the frame to processpublic void onContinuationFrame(ByteBuffer buffer, boolean fin) throws IOException
onContinuationFrame
in interface EventDriver
IOException
public void onPong(ByteBuffer buffer)
onPong
in interface EventDriver
public void onPing(ByteBuffer buffer)
onPing
in interface EventDriver
public BatchMode getBatchMode()
getBatchMode
in interface EventDriver
public void openSession(WebSocketSession session)
openSession
in interface EventDriver
protected void doStop() throws Exception
doStop
in class AbstractLifeCycle
Exception
protected void terminateConnection(int statusCode, String rawreason)
Copyright © 1995-2016 Webtide. All Rights Reserved.