public class SockJSSocket extends Object implements ReadStream<Buffer>, WriteStream<Buffer>
The API is very similar to WebSocket.
It implements both and
so it can be used with
Pump to pump data with flow control.
NOTE: This class has been automatically generated from the
original non RX-ified interface using Vert.x codegen.| Constructor and Description |
|---|
SockJSSocket(SockJSSocket delegate) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close it
|
SockJSSocket |
drainHandler(Handler<Void> handler)
Set a drain handler on the stream.
|
SockJSSocket |
endHandler(Handler<Void> endHandler)
Set an end handler.
|
SockJSSocket |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the read stream.
|
Object |
getDelegate() |
SockJSSocket |
handler(Handler<Buffer> handler)
Set a data handler.
|
MultiMap |
headers()
Return the headers corresponding to the last request for this socket or the websocket handshake
Any cookie headers will be removed for security reasons
|
SocketAddress |
localAddress()
Return the local address for this socket
|
static SockJSSocket |
newInstance(SockJSSocket arg) |
SockJSSocket |
pause()
Pause the
ReadSupport. |
SocketAddress |
remoteAddress()
Return the remote address for this socket
|
SockJSSocket |
resume()
Resume reading.
|
SockJSSocket |
setWriteQueueMaxSize(int maxSize)
Set the maximum size of the write queue to
maxSize. |
rx.Observable<Buffer> |
toObservable() |
String |
uri()
Return the URI corresponding to the last request for this socket or the websocket handshake
|
Session |
webSession() |
User |
webUser() |
SockJSSocket |
write(Buffer data)
Write some data to the stream.
|
String |
writeHandlerID()
When a
SockJSSocket is created it automatically registers an event handler with the event bus, the ID of that
handler is given by writeHandlerID. |
boolean |
writeQueueFull()
This will return
true if there are more bytes in the write queue than the value set using WriteStream.setWriteQueueMaxSize(int) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitnewInstancenewInstancenewInstancepublic SockJSSocket(SockJSSocket delegate)
public Object getDelegate()
getDelegate 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()
WriteStreamtrue if there are more bytes in the write queue than the value set using WriteStream.setWriteQueueMaxSize(int)writeQueueFull in interface WriteStream<Buffer>public SockJSSocket exceptionHandler(Handler<Throwable> handler)
ReadStreamexceptionHandler in interface ReadStream<Buffer>exceptionHandler in interface StreamBaseexceptionHandler in interface WriteStream<Buffer>handler - the exception handlerpublic SockJSSocket handler(Handler<Buffer> handler)
ReadStreamhandler in interface ReadStream<Buffer>public SockJSSocket pause()
ReadStreamReadSupport. While it's paused, no data will be sent to the dataHandlerpause in interface ReadStream<Buffer>public SockJSSocket resume()
ReadStreamReadSupport has been paused, reading will recommence on it.resume in interface ReadStream<Buffer>public SockJSSocket endHandler(Handler<Void> endHandler)
ReadStreamendHandler in interface ReadStream<Buffer>public SockJSSocket write(Buffer data)
WriteStreamWriteStream.writeQueueFull() method before writing. This is done automatically if using a Pump.write in interface WriteStream<Buffer>data - the data to writepublic SockJSSocket 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 WriteStream<Buffer>maxSize - the max size of the write streampublic SockJSSocket drainHandler(Handler<Void> handler)
WriteStreamPump for an example of this being used.drainHandler in interface WriteStream<Buffer>handler - the handlerpublic String writeHandlerID()
SockJSSocket is created it automatically registers an event handler with the event bus, the ID of that
handler is given by writeHandlerID.
Given this ID, a different event loop can send a buffer 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 socket. This allows you to write data to other sockets which are owned by different event loops.
public void close()
public SocketAddress remoteAddress()
public SocketAddress localAddress()
public MultiMap headers()
public String uri()
public Session webSession()
public User webUser()
public static SockJSSocket newInstance(SockJSSocket arg)
Copyright © 2015. All rights reserved.