public class WebSocket extends Object implements WebSocketBase
original non RX-ified interface using Vert.x codegen.| 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. |
void |
close()
Close the WebSocket.
|
WebSocket |
closeHandler(Handler<Void> handler)
Set a close handler.
|
WebSocket |
drainHandler(Handler<Void> handler)
Set a drain handler on the stream.
|
WebSocket |
endHandler(Handler<Void> endHandler)
Set an end handler.
|
WebSocket |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the read stream.
|
WebSocket |
frameHandler(Handler<WebSocketFrame> handler)
Set a frame handler on the connection.
|
Object |
getDelegate() |
WebSocket |
handler(Handler<Buffer> handler)
Set a data handler.
|
SocketAddress |
localAddress() |
static WebSocket |
newInstance(WebSocket arg) |
WebSocket |
pause()
Pause the
ReadSupport. |
SocketAddress |
remoteAddress() |
WebSocket |
resume()
Resume reading.
|
WebSocket |
setWriteQueueMaxSize(int maxSize)
Set the maximum size of the write queue to
maxSize. |
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. |
rx.Observable<Buffer> |
toObservable() |
WebSocket |
write(Buffer data)
Write some data to the stream.
|
WebSocket |
writeBinaryMessage(Buffer data)
Writes a (potentially large) piece of binary data to the connection.
|
WebSocket |
writeFinalBinaryFrame(Buffer data)
Write a final WebSocket binary frame to the connection
|
WebSocket |
writeFinalTextFrame(String text)
Write a final WebSocket text frame to the connection
|
WebSocket |
writeFrame(WebSocketFrame frame)
Write a WebSocket frame to the connection
|
boolean |
writeQueueFull()
This will return
true if there are more bytes in the write queue than the value set using setWriteQueueMaxSize(int) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitnewInstancenewInstancenewInstancenewInstancepublic WebSocket(WebSocket delegate)
public Object getDelegate()
getDelegate in interface WebSocketBasegetDelegate in interface ReadStream<Buffer>getDelegate in interface StreamBasegetDelegate in interface WriteStream<Buffer>public rx.Observable<Buffer> toObservable()
toObservable in interface ReadStream<Buffer>public boolean writeQueueFull()
true if there are more bytes in the write queue than the value set using setWriteQueueMaxSize(int)writeQueueFull in interface WebSocketBasewriteQueueFull in interface WriteStream<Buffer>public String binaryHandlerID()
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 WebSocketBasepublic String textHandlerID()
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 WebSocketBasepublic void close()
close in interface WebSocketBasepublic SocketAddress remoteAddress()
remoteAddress in interface WebSocketBasepublic SocketAddress localAddress()
localAddress in interface WebSocketBasepublic WebSocket exceptionHandler(Handler<Throwable> handler)
ReadStreamexceptionHandler in interface WebSocketBaseexceptionHandler in interface ReadStream<Buffer>exceptionHandler in interface StreamBaseexceptionHandler in interface WriteStream<Buffer>handler - the exception handlerpublic WebSocket handler(Handler<Buffer> handler)
ReadStreamhandler in interface WebSocketBasehandler in interface ReadStream<Buffer>public WebSocket pause()
ReadStreamReadSupport. While it's paused, no data will be sent to the dataHandlerpause in interface WebSocketBasepause in interface ReadStream<Buffer>public WebSocket resume()
ReadStreamReadSupport has been paused, reading will recommence on it.resume in interface WebSocketBaseresume in interface ReadStream<Buffer>public WebSocket endHandler(Handler<Void> endHandler)
ReadStreamendHandler in interface WebSocketBaseendHandler in interface ReadStream<Buffer>public WebSocket write(Buffer data)
WriteStreamWriteStream.writeQueueFull() method before writing. This is done automatically if using a Pump.write in interface WebSocketBasewrite in interface WriteStream<Buffer>data - the data to writepublic WebSocket setWriteQueueMaxSize(int maxSize)
WriteStreammaxSize. You will still be able to write to the stream even
if there is more than maxSize bytes in the write queue. This is used as an indicator by classes such as
Pump to provide flow control.setWriteQueueMaxSize in interface WebSocketBasesetWriteQueueMaxSize in interface WriteStream<Buffer>maxSize - the max size of the write streampublic WebSocket drainHandler(Handler<Void> handler)
WriteStreamPump for an example of this being used.drainHandler in interface WebSocketBasedrainHandler in interface WriteStream<Buffer>handler - the handlerpublic WebSocket writeFrame(WebSocketFrame frame)
WebSocketBasewriteFrame in interface WebSocketBaseframe - the frame to writepublic WebSocket writeFinalTextFrame(String text)
WebSocketBasewriteFinalTextFrame in interface WebSocketBasetext - The text to writepublic WebSocket writeFinalBinaryFrame(Buffer data)
WebSocketBasewriteFinalBinaryFrame in interface WebSocketBasedata - The data to writepublic WebSocket writeBinaryMessage(Buffer data)
WebSocketBasewriteBinaryMessage in interface WebSocketBasedata - the data to writepublic WebSocket closeHandler(Handler<Void> handler)
WebSocketBasecloseHandler in interface WebSocketBasehandler - the handlerpublic WebSocket frameHandler(Handler<WebSocketFrame> handler)
WebSocketBaseframeHandler in interface WebSocketBasehandler - the handlerCopyright © 2015. All rights reserved.