Class: SockJSSocket

vertx-web-js/sock_js_socket~ SockJSSocket

new SockJSSocket()

You interact with SockJS clients through instances of SockJS socket.

Source:

Methods

close(statusCode, reason)

Close it giving a status code and reason. Only Applicable to RawWebSocket will downgrade to plain close for other transports.
Parameters:
Name Type Description
statusCode number
reason string
Source:

drainHandler(handler) → {SockJSSocket}

Parameters:
Name Type Description
handler function
Source:
Returns:
Type
SockJSSocket

end(data, handler)

Same as but with an handler called when the operation completes
Parameters:
Name Type Description
data Buffer
handler function
Source:

endHandler(endHandler) → {SockJSSocket}

Parameters:
Name Type Description
endHandler function
Source:
Returns:
Type
SockJSSocket

exceptionHandler(handler) → {SockJSSocket}

Parameters:
Name Type Description
handler function
Source:
Returns:
Type
SockJSSocket

fetch(amount) → {ReadStream}

Fetch the specified amount of elements. If the ReadStream has been paused, reading will recommence with the specified amount of items, otherwise the specified amount will be added to the current stream demand.
Parameters:
Name Type Description
amount number
Source:
Returns:
a reference to this, so the API can be used fluently
Type
ReadStream

handler(handler) → {SockJSSocket}

Parameters:
Name Type Description
handler function
Source:
Returns:
Type
SockJSSocket

headers() → {MultiMap}

Return the headers corresponding to the last request for this socket or the websocket handshake Any cookie headers will be removed for security reasons
Source:
Returns:
Type
MultiMap

localAddress() → {SocketAddress}

Return the local address for this socket
Source:
Returns:
Type
SocketAddress

pause() → {SockJSSocket}

Source:
Returns:
Type
SockJSSocket

pipe() → {Pipe}

Pause this stream and return a to transfer the elements of this stream to a destination .

The stream will be resumed when the pipe will be wired to a WriteStream.

Source:
Returns:
a pipe
Type
Pipe

pipeTo(dst, handler)

Pipe this ReadStream to the WriteStream.

Elements emitted by this stream will be written to the write stream until this stream ends or fails.

Once this stream has ended or failed, the write stream will be ended and the handler will be called with the result.

Parameters:
Name Type Description
dst WriteStream the destination write stream
handler function
Source:

remoteAddress() → {SocketAddress}

Return the remote address for this socket
Source:
Returns:
Type
SocketAddress

resume() → {SockJSSocket}

Source:
Returns:
Type
SockJSSocket

setWriteQueueMaxSize(maxSize) → {SockJSSocket}

Parameters:
Name Type Description
maxSize number
Source:
Returns:
Type
SockJSSocket

uri() → {string}

Return the URI corresponding to the last request for this socket or the websocket handshake
Source:
Returns:
Type
string

webSession() → {Session}

Source:
Returns:
the Vert.x-Web session corresponding to this socket
Type
Session

webUser() → {User}

Source:
Returns:
the Vert.x-Web user corresponding to this socket
Type
User

write(data, handler)

Parameters:
Name Type Description
data Buffer
handler function
Source:

writeHandlerID() → {string}

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.

Source:
Returns:
Type
string

writeQueueFull() → {boolean}

This will return true if there are more bytes in the write queue than the value set using SockJSSocket#setWriteQueueMaxSize
Source:
Returns:
true if write queue is full
Type
boolean