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.
|
void |
end()
|
void |
end(Buffer t)
Same as
WriteStream.end() but writes some data to the stream before ending. |
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 . |
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, wait
newInstance
newInstance
newInstance
public SockJSSocket(SockJSSocket delegate)
public Object getDelegate()
getDelegate
in interface ReadStream<Buffer>
getDelegate
in interface StreamBase
getDelegate
in interface WriteStream<Buffer>
public Observable<Buffer> toObservable()
toObservable
in interface ReadStream<Buffer>
public void end(Buffer t)
WriteStream
WriteStream.end()
but writes some data to the stream before ending.end
in interface WriteStream<Buffer>
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 SockJSSocket exceptionHandler(Handler<Throwable> handler)
ReadStream
exceptionHandler
in interface ReadStream<Buffer>
exceptionHandler
in interface StreamBase
exceptionHandler
in interface WriteStream<Buffer>
handler
- the exception handlerpublic SockJSSocket handler(Handler<Buffer> handler)
ReadStream
handler
in interface ReadStream<Buffer>
public SockJSSocket pause()
ReadStream
ReadSupport
. While it's paused, no data will be sent to the dataHandler
pause
in interface ReadStream<Buffer>
public SockJSSocket resume()
ReadStream
ReadSupport
has been paused, reading will recommence on it.resume
in interface ReadStream<Buffer>
public SockJSSocket endHandler(Handler<Void> endHandler)
ReadStream
endHandler
in interface ReadStream<Buffer>
public SockJSSocket write(Buffer data)
WriteStream
WriteStream.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)
WriteStream
maxSize
. 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)
WriteStream
Pump
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 end()
end
in interface WriteStream<Buffer>
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 © 2016. All rights reserved.