Options
All
  • Public
  • Public/Protected
  • All
Menu

Class XHRTransport

The implementation of the Transport interface for XHR polling

Hierarchy

  • any
    • XHRTransport

Implements

  • any

Index

Constructors

constructor

  • Construct a new XHRTransport instance

    Parameters

    • opts: OptionsImpl

      the connection options

    • xhr: object

      the transport constructor function

    Returns XHRTransport

Properties

Private URI

URI: string

The connection URI

Private aborted

aborted: boolean

A flag indicating whether sending of poll requests has been aborted

Private emitter

emitter: Emitter

The emitter used for emitting events

Private isSending

isSending: boolean

A flag indicating that the transport is currently sending requests

Private opts

The connection options

Private pingSequence

pingSequence: number

A sequence number for ping requests

Private pollRequest

pollRequest: any

The last poll request

Private pollSequence

pollSequence: number

A sequence number for polling requests

Private protocolVersion

protocolVersion: number | null

The protocol version

Private queue

queue: Queue<Buffer>

The message queue

Private token

token: SessionToken | null

The session token that was received from the server at connection

Private xhr

xhr: object

The transport constructor function

Type declaration

Methods

close

  • close(): this
  • Aborting any opening poll request.

    Returns this

    this instance

connect

  • Establish a polling connection with the server.

    Parameters

    Returns void

createRequest

  • createRequest(headers: object, uri: string): any
  • This is the generic method to send data to the server

    Parameters

    • headers: object

      the headers to send to the server

      • [header: string]: any
    • uri: string

      the URI to connect to

    Returns any

dispatch

  • dispatch(message: Buffer): boolean | undefined
  • Queue message to be sent to the message message-queue.

    Delegate the actual request sending to #flush().

    Parameters

    • message: Buffer

      to be queued

    Returns boolean | undefined

flush

  • flush(): void
  • Flush all pending messages from the message-queue and send upstream.

    Returns void

poll

  • poll(): void
  • Send a poll request to the server.

    Returns void