public abstract class WebSocketImplBase extends Object implements WebSocketBase
Modifier and Type | Field and Description |
---|---|
protected boolean |
closed |
protected Handler<Void> |
closeHandler |
protected ConnectionBase |
conn |
protected Handler<Buffer> |
dataHandler |
protected Handler<Void> |
drainHandler |
protected Handler<Void> |
endHandler |
protected Handler<Throwable> |
exceptionHandler |
protected Handler<WebSocketFrame> |
frameHandler |
Modifier | Constructor and Description |
---|---|
protected |
WebSocketImplBase(VertxInternal vertx,
ConnectionBase conn,
boolean supportsContinuation,
int maxWebSocketFrameSize) |
Modifier and Type | Method and Description |
---|---|
String |
binaryHandlerID()
When a
Websocket is created it automatically registers an event handler with the event bus - the ID of that
handler is given by this method. |
protected void |
checkClosed() |
void |
close()
Close the WebSocket.
|
abstract WebSocketBase |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the read stream.
|
SocketAddress |
localAddress() |
SocketAddress |
remoteAddress() |
String |
textHandlerID()
When a
Websocket is created it automatically registers an event handler with the eventbus, the ID of that
handler is given by textHandlerID . |
protected void |
writeBinaryFrameInternal(Buffer data) |
protected void |
writeFrameInternal(WebSocketFrame frame) |
protected void |
writeMessageInternal(Buffer data) |
protected void |
writePartialMessage(Buffer data,
int offset) |
boolean |
writeQueueFull()
This will return
true if there are more bytes in the write queue than the value set using WriteStream.setWriteQueueMaxSize(int) |
protected void |
writeTextFrameInternal(String str) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
closeHandler, drainHandler, endHandler, frameHandler, handler, pause, resume, setWriteQueueMaxSize, write, writeBinaryMessage, writeFinalBinaryFrame, writeFinalTextFrame, writeFrame
protected final ConnectionBase conn
protected Handler<WebSocketFrame> frameHandler
protected boolean closed
protected WebSocketImplBase(VertxInternal vertx, ConnectionBase conn, boolean supportsContinuation, int maxWebSocketFrameSize)
public String binaryHandlerID()
WebSocketBase
Websocket
is created it automatically registers an event handler with the event bus - the ID of that
handler is given by this method.
Given this ID, a different event loop can send a binary frame to that event handler using the event bus and that buffer will be received by this instance in its own event loop and written to the underlying connection. This allows you to write data to other WebSockets which are owned by different event loops.
binaryHandlerID
in interface WebSocketBase
public String textHandlerID()
WebSocketBase
Websocket
is created it automatically registers an event handler with the eventbus, the ID of that
handler is given by textHandlerID
.
Given this ID, a different event loop can send a text frame to that event handler using the event bus and that buffer will be received by this instance in its own event loop and written to the underlying connection. This allows you to write data to other WebSockets which are owned by different event loops.
textHandlerID
in interface WebSocketBase
public boolean writeQueueFull()
WriteStream
true
if there are more bytes in the write queue than the value set using WriteStream.setWriteQueueMaxSize(int)
writeQueueFull
in interface WriteStream<Buffer>
public void close()
WebSocketBase
close
in interface WebSocketBase
public SocketAddress localAddress()
localAddress
in interface WebSocketBase
public SocketAddress remoteAddress()
remoteAddress
in interface WebSocketBase
public abstract WebSocketBase exceptionHandler(Handler<Throwable> handler)
ReadStream
exceptionHandler
in interface WebSocketBase
exceptionHandler
in interface ReadStream<Buffer>
exceptionHandler
in interface StreamBase
exceptionHandler
in interface WriteStream<Buffer>
handler
- the exception handlerprotected void writeMessageInternal(Buffer data)
protected void writePartialMessage(Buffer data, int offset)
protected void writeBinaryFrameInternal(Buffer data)
protected void writeTextFrameInternal(String str)
protected void writeFrameInternal(WebSocketFrame frame)
protected void checkClosed()
Copyright © 2015. All Rights Reserved.