public interface SockJSSocket extends ReadStream<Buffer>, WriteStream<Buffer>
The API is very similar to WebSocket.
It implements both ReadStream and WriteStream
so it can be used with
Pump to pump data with flow control.
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close it
|
SockJSSocket |
drainHandler(Handler<Void> handler) |
void |
end()
Call
end(). |
SockJSSocket |
endHandler(Handler<Void> endHandler) |
SockJSSocket |
exceptionHandler(Handler<Throwable> handler) |
SockJSSocket |
handler(Handler<Buffer> 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
|
SockJSSocket |
pause() |
SocketAddress |
remoteAddress()
Return the remote address for this socket
|
SockJSSocket |
resume() |
SockJSSocket |
setWriteQueueMaxSize(int maxSize) |
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) |
default SockJSSocket |
write(String data)
Write a
String to the socket, encoded in UTF-8. |
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. |
end, writeQueueFullSockJSSocket exceptionHandler(Handler<Throwable> handler)
exceptionHandler in interface ReadStream<Buffer>exceptionHandler in interface StreamBaseexceptionHandler in interface WriteStream<Buffer>SockJSSocket handler(Handler<Buffer> handler)
handler in interface ReadStream<Buffer>SockJSSocket pause()
pause in interface ReadStream<Buffer>SockJSSocket resume()
resume in interface ReadStream<Buffer>SockJSSocket endHandler(Handler<Void> endHandler)
endHandler in interface ReadStream<Buffer>SockJSSocket write(Buffer data)
write in interface WriteStream<Buffer>default SockJSSocket write(String data)
String to the socket, encoded in UTF-8.data - the string to writeSockJSSocket setWriteQueueMaxSize(int maxSize)
setWriteQueueMaxSize in interface WriteStream<Buffer>SockJSSocket drainHandler(Handler<Void> handler)
drainHandler in interface WriteStream<Buffer>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.
void end()
end().end in interface WriteStream<Buffer>void close()
SocketAddress remoteAddress()
SocketAddress localAddress()
MultiMap headers()
String uri()
Session webSession()
User webUser()
Copyright © 2017. All rights reserved.