public class WebSocketSession extends StreamSession implements IWebSocketSession
Constructor and Description |
---|
WebSocketSession(IWebSocketHandler handler,
boolean clientMode)
Constructs a Web Socket session associated with a Web Socket handler.
|
WebSocketSession(String name,
IWebSocketHandler handler,
boolean clientMode)
Constructs a named Web Socket session associated with a Web Socket handler.
|
Modifier and Type | Method and Description |
---|---|
void |
close(int status)
Writes the Web Socket close frame with given status code and then gently
closes this session.
|
void |
close(int status,
String reason)
Writes the Web Socket close frame with given status code and reason and then
gently closes this session.
|
long |
getCreationTime() |
IHandshaker |
getHandshaker()
Returns the Web Socket handshaker associated with this session.
|
long |
getLastIoTime() |
long |
getLastReadTime() |
long |
getLastWriteTime() |
long |
getReadBytes() |
double |
getReadBytesThroughput() |
IFuture<Void> |
getReadyFuture()
Gets the future that can be use to wait for the completion of the Web Socket
handshake phase.
|
IWebSocketHandler |
getWebSocketHandler()
Returns the Web Socket handler associated with this session
|
long |
getWrittenBytes() |
double |
getWrittenBytesThroughput() |
close, getHandler, getLocalAddress, getParent, getPipeline, getRemoteAddress, getState, write, write, write, write, write, write, writenf, writenf, writenf, writenf, writenf, writenf
getAttributes
getId, getName, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getHandler, getParent, getPipeline, write, write, write, write, write, write, writenf, writenf, writenf, writenf, writenf, writenf
allocate, close, dirtyClose, execute, executenf, getAttributes, getCloseFuture, getCodecPipeline, getConfig, getCreateFuture, getCreationTime, getEndFuture, getId, getLastIoTime, getLastReadTime, getLastWriteTime, getLocalAddress, getName, getOpenFuture, getReadBytes, getReadBytesThroughput, getRemoteAddress, getState, getTimer, getWrittenBytes, getWrittenBytesThroughput, isDataCopyingOptimized, isOpen, isReadSuspended, isWriteSuspended, quickClose, release, resumeRead, resumeWrite, suspendRead, suspendWrite
public WebSocketSession(String name, IWebSocketHandler handler, boolean clientMode)
name
- the name for this session, or null
if the
handler's name should be used for this session's namehandler
- the Web Socket handler that should be associated with this
sessionclientMode
- true
if the session should start its
handshaking in "client" modepublic WebSocketSession(IWebSocketHandler handler, boolean clientMode)
handler
- the Web Socket handler that should be associated with this
sessionclientMode
- true
if the session should start its
handshaking in "client" modepublic IFuture<Void> getReadyFuture()
getReadyFuture
in interface ISession
getReadyFuture
in class StreamSession
public IWebSocketHandler getWebSocketHandler()
IWebSocketSession
getWebSocketHandler
in interface IWebSocketSession
public IHandshaker getHandshaker()
IWebSocketSession
getHandshaker
in interface IWebSocketSession
public void close(int status)
IWebSocketSession
close
in interface IWebSocketSession
status
- the status code of the close frame, or -1 if the close frame
should not contain the application body.public void close(int status, String reason)
IWebSocketSession
close
in interface IWebSocketSession
status
- the status code of the close frame, or -1 if the close frame
should not contain the application body.reason
- the reason of the close frame. If the status
argument
equals -1 this argument is ignored.public final long getReadBytes()
getReadBytes
in interface ISession
public final long getWrittenBytes()
getWrittenBytes
in interface ISession
public final double getReadBytesThroughput()
getReadBytesThroughput
in interface ISession
public final double getWrittenBytesThroughput()
getWrittenBytesThroughput
in interface ISession
public final long getCreationTime()
getCreationTime
in interface ISession
public final long getLastIoTime()
getLastIoTime
in interface ISession
public final long getLastReadTime()
getLastReadTime
in interface ISession
public final long getLastWriteTime()
getLastWriteTime
in interface ISession
Copyright © 2017–2022 SNF4J.ORG. All rights reserved.