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
|
default void |
close(int statusCode,
String reason)
Close it giving a status code and reason.
|
SockJSSocket |
closeHandler(Handler<Void> closeHandler) |
SockJSSocket |
drainHandler(Handler<Void> handler) |
Future<Void> |
end()
Call
close(). |
SockJSSocket |
endHandler(Handler<Void> endHandler) |
SockJSSocket |
exceptionHandler(Handler<Throwable> handler) |
SockJSSocket |
fetch(long amount) |
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() |
RoutingContext |
routingContext() |
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() |
default Future<Void> |
write(Buffer data) |
void |
write(Buffer data,
Handler<AsyncResult<Void>> handler) |
default Future<Void> |
write(String data)
Write a
String to the socket, encoded in UTF-8. |
default void |
write(String data,
Handler<AsyncResult<Void>> handler) |
String |
writeHandlerID()
When a
SockJSSocket is created it can register an event handler with the event bus, the ID of that
handler is given by writeHandlerID. |
pipe, pipeTo, pipeToend, end, 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 fetch(long amount)
fetch in interface ReadStream<Buffer>SockJSSocket endHandler(Handler<Void> endHandler)
endHandler in interface ReadStream<Buffer>SockJSSocket closeHandler(Handler<Void> closeHandler)
default Future<Void> write(String data)
String to the socket, encoded in UTF-8.data - the string to writedefault void write(String data, Handler<AsyncResult<Void>> handler)
void write(Buffer data, Handler<AsyncResult<Void>> handler)
write in interface WriteStream<Buffer>SockJSSocket setWriteQueueMaxSize(int maxSize)
setWriteQueueMaxSize in interface WriteStream<Buffer>SockJSSocket drainHandler(Handler<Void> handler)
drainHandler in interface WriteStream<Buffer>String writeHandlerID()
SockJSSocket is created it can register 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.
writeHandlerID or null if writeHandler registration is disabled in SockJSHandlerOptionsvoid close()
default void close(int statusCode,
String reason)
SocketAddress remoteAddress()
SocketAddress localAddress()
MultiMap headers()
String uri()
RoutingContext routingContext()
Session webSession()
User webUser()
Copyright © 2022 Eclipse. All rights reserved.