Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SockJSSocket

You interact with SockJS clients through instances of SockJS socket.

The API is very similar to {@link WebSocket}. It implements both and so it can be used with {@link Pump} to pump data with flow control.

Hierarchy

  • SockJSSocket

Implements

  • any
  • any

Index

Methods

close

  • close(): void
  • close(statusCode: number, reason: string): void
  • Close it

    Returns void

  • Close it giving a status code and reason. Only Applicable to RawWebSocket will downgrade to plain close for other transports.

    Parameters

    • statusCode: number
    • reason: string

    Returns void

closeHandler

  • closeHandler(closeHandler: ((res: void) => void) | Handler<void>): SockJSSocket
  • Parameters

    • closeHandler: ((res: void) => void) | Handler<void>

    Returns SockJSSocket

drainHandler

  • drainHandler(handler: ((res: void) => void) | Handler<void> | null | undefined): SockJSSocket
  • Parameters

    • handler: ((res: void) => void) | Handler<void> | null | undefined

    Returns SockJSSocket

end

  • end(): PromiseLike<void>
  • end(arg0: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • end(data: Buffer): PromiseLike<void>
  • end(data: Buffer, handler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Returns PromiseLike<void>

  • Parameters

    • arg0: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

  • Parameters

    • data: Buffer

    Returns PromiseLike<void>

  • Parameters

    • data: Buffer
    • handler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

endHandler

  • endHandler(endHandler: ((res: void) => void) | Handler<void> | null | undefined): SockJSSocket
  • Parameters

    • endHandler: ((res: void) => void) | Handler<void> | null | undefined

    Returns SockJSSocket

exceptionHandler

  • exceptionHandler(handler: ((res: Throwable) => void) | Handler<Throwable> | null | undefined): SockJSSocket
  • Parameters

    • handler: ((res: Throwable) => void) | Handler<Throwable> | null | undefined

    Returns SockJSSocket

fetch

  • Parameters

    • amount: number

    Returns SockJSSocket

handler

  • handler(handler: ((res: Buffer) => void) | Handler<Buffer> | null | undefined): SockJSSocket
  • Parameters

    • handler: ((res: Buffer) => void) | Handler<Buffer> | null | undefined

    Returns SockJSSocket

headers

  • 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

    Returns MultiMap

localAddress

  • localAddress(): SocketAddress
  • Return the local address for this socket

    Returns SocketAddress

pause

  • Returns SockJSSocket

pipe

  • pipe(): Pipe<Buffer>
  • Returns Pipe<Buffer>

pipeTo

  • pipeTo(dst: WriteStream<Buffer>): PromiseLike<void>
  • pipeTo(dst: WriteStream<Buffer>, handler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Parameters

    • dst: WriteStream<Buffer>

    Returns PromiseLike<void>

  • Parameters

    • dst: WriteStream<Buffer>
    • handler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

remoteAddress

  • remoteAddress(): SocketAddress
  • Return the remote address for this socket

    Returns SocketAddress

resume

  • Returns SockJSSocket

routingContext

  • Returns RoutingContext

setWriteQueueMaxSize

  • Parameters

    • maxSize: number

    Returns SockJSSocket

uri

  • uri(): string
  • Return the URI corresponding to the last request for this socket or the websocket handshake

    Returns string

webSession

  • Returns Session | null

webUser

  • webUser(): User | null
  • Returns User | null

write

  • write(data: string): PromiseLike<void>
  • write(data: string, handler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • write(data: Buffer): PromiseLike<void>
  • write(data: Buffer, handler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Parameters

    • data: string

    Returns PromiseLike<void>

  • Parameters

    • data: string
    • handler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

  • Parameters

    • data: Buffer

    Returns PromiseLike<void>

  • Parameters

    • data: Buffer
    • handler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

writeHandlerID

  • writeHandlerID(): string
  • When a 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.

    Returns string

writeQueueFull

  • writeQueueFull(): boolean
  • Returns boolean

Generated using TypeDoc