You interact with SockJS clients through instances of SockJS socket.

The API is very similar to io.vertx.core.http.WebSocket. It implements both and so it can be used with io.vertx.core.streams.Pump to pump data with flow control.

  • SockJSSocket
    • Basic
      • Identifiable
      • Object
        • Anything
    • ReadStream
      • StreamBase
    • WriteStream
      • StreamBase

no subtypes hierarchy

Initializer
SockJSSocket(SockJSSocket unknown)
Inherited Attributes
Attributes inherited from: Object
hash, string
Methods
closeshared default void close()

Close it

drainHandlershared actual default SockJSSocket drainHandler(Anything() handler)

Set a drain handler on the stream. If the write queue is full, then the handler will be called when the write queue has been reduced to maxSize / 2. See Pump for an example of this being used.

Refines WriteStream.drainHandler
endshared actual default void end()

Call end.

Refines WriteStream.end
endshared actual default void end(Buffer t)

Same as end but writes some data to the stream before ending.

Refines WriteStream.end
endHandlershared actual default SockJSSocket endHandler(Anything() endHandler)

Set an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called.

Refines ReadStream.endHandler
exceptionHandlershared actual default SockJSSocket exceptionHandler(Anything(Throwable) handler)

Set an exception handler.

Refines StreamBase.exceptionHandler
handlershared actual default SockJSSocket handler(Anything(Buffer) handler)

Set a data handler. As data is read, the handler will be called with the data.

Refines ReadStream.handler
headersshared default 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

localAddressshared default SocketAddress localAddress()

Return the local address for this socket

pauseshared actual default SockJSSocket pause()

Pause the ReadSupport. While it's paused, no data will be sent to the dataHandler

Refines ReadStream.pause
remoteAddressshared default SocketAddress remoteAddress()

Return the remote address for this socket

resumeshared actual default SockJSSocket resume()

Resume reading. If the ReadSupport has been paused, reading will recommence on it.

Refines ReadStream.resume
setWriteQueueMaxSizeshared actual default SockJSSocket setWriteQueueMaxSize(Integer maxSize)

Set the maximum size of the write queue to 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.

Refines WriteStream.setWriteQueueMaxSize
urishared default String uri()

Return the URI corresponding to the last request for this socket or the websocket handshake

webSessionshared default Session? webSession()

@return the Vert.x-Web session corresponding to this socket

webUsershared default User? webUser()

@return the Vert.x-Web user corresponding to this socket

writeshared actual default SockJSSocket write(Buffer data)

Write some data to the stream. The data is put on an internal write queue, and the write actually happens asynchronously. To avoid running out of memory by putting too much on the write queue, check the writeQueueFull method before writing. This is done automatically if using a Pump.

Refines WriteStream.write
writeHandlerIDshared default 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.

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.

writeQueueFullshared actual default Boolean writeQueueFull()

This will return true if there are more bytes in the write queue than the value set using setWriteQueueMaxSize

Refines WriteStream.writeQueueFull
Inherited Methods
Methods inherited from: Object
equals
Methods inherited from: ReadStream<T>
endHandler, exceptionHandler, handler, pause, resume
Methods inherited from: StreamBase
exceptionHandler
Methods inherited from: WriteStream<T>
drainHandler, end, exceptionHandler, setWriteQueueMaxSize, write, writeQueueFull