public interface SockJSSocket
extends io.vertx.core.streams.ReadStream<io.vertx.core.buffer.Buffer>, io.vertx.core.streams.WriteStream<io.vertx.core.buffer.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(io.vertx.core.Handler<Void> handler) |
void |
end()
Call
end() . |
SockJSSocket |
endHandler(io.vertx.core.Handler<Void> endHandler) |
SockJSSocket |
exceptionHandler(io.vertx.core.Handler<Throwable> handler) |
SockJSSocket |
handler(io.vertx.core.Handler<io.vertx.core.buffer.Buffer> handler) |
io.vertx.core.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
|
io.vertx.core.net.SocketAddress |
localAddress()
Return the local address for this socket
|
SockJSSocket |
pause() |
io.vertx.core.net.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() |
io.vertx.ext.auth.User |
webUser() |
SockJSSocket |
write(io.vertx.core.buffer.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 . |
SockJSSocket exceptionHandler(io.vertx.core.Handler<Throwable> handler)
exceptionHandler
in interface io.vertx.core.streams.ReadStream<io.vertx.core.buffer.Buffer>
exceptionHandler
in interface io.vertx.core.streams.StreamBase
exceptionHandler
in interface io.vertx.core.streams.WriteStream<io.vertx.core.buffer.Buffer>
SockJSSocket handler(io.vertx.core.Handler<io.vertx.core.buffer.Buffer> handler)
handler
in interface io.vertx.core.streams.ReadStream<io.vertx.core.buffer.Buffer>
SockJSSocket pause()
pause
in interface io.vertx.core.streams.ReadStream<io.vertx.core.buffer.Buffer>
SockJSSocket resume()
resume
in interface io.vertx.core.streams.ReadStream<io.vertx.core.buffer.Buffer>
SockJSSocket endHandler(io.vertx.core.Handler<Void> endHandler)
endHandler
in interface io.vertx.core.streams.ReadStream<io.vertx.core.buffer.Buffer>
SockJSSocket write(io.vertx.core.buffer.Buffer data)
write
in interface io.vertx.core.streams.WriteStream<io.vertx.core.buffer.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 io.vertx.core.streams.WriteStream<io.vertx.core.buffer.Buffer>
SockJSSocket drainHandler(io.vertx.core.Handler<Void> handler)
drainHandler
in interface io.vertx.core.streams.WriteStream<io.vertx.core.buffer.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 io.vertx.core.streams.WriteStream<io.vertx.core.buffer.Buffer>
void close()
io.vertx.core.net.SocketAddress remoteAddress()
io.vertx.core.net.SocketAddress localAddress()
io.vertx.core.MultiMap headers()
String uri()
Session webSession()
io.vertx.ext.auth.User webUser()
Copyright © 2018. All rights reserved.