Class for socket communication.

Hierarchy (view full)

Constructors

Properties

STATE_CONNECTED

The socket is connected to the server.

STATE_CONNECTING

The socket is connecting to the server.

STATE_DISCONNECTED

The socket is disconnected from the server.

STATE_NONE

Unknown state of the socket.

Methods

  • Connects the client to the server.

    Returns void

  • Connects the client to the server.

    Parameters

    • address: string

      Server address.

    Returns void

  • Emits the socket event.

    Parameters

    • event: string

      Name of the event.

    Returns this

  • Emits the socket event.

    Parameters

    • event: string

      Name of the event.

    • key: string

      Socket event key.

    Returns this

  • Emits the socket event.

    Type Parameters

    • P = any

    Parameters

    • event: string

      Name of the event.

    • key: string

      Socket event key.

    • data: P

      Event parameters.

    Returns this

    P Type of parameters.

  • Emits the socket event.

    Type Parameters

    • P = any

    Parameters

    • event: string

      Name of the event.

    • key: string

      Socket event key.

    • data: P

      Event parameters.

    • onProgress: ((progress: number) => void)

      Function called in the progress tick.

        • (progress): void
        • Parameters

          • progress: number

          Returns void

    Returns this

    P Type of parameters.

  • Indicates if the socket is connected to the server.

    Returns boolean

  • Registers socket events.

    This method is called automatically in after the bundle load.

    Parameters

    • events: string[]

      List of socket events.

    Returns this

  • Sets the chunk size of socket message.

    Parameters

    • chunkSize: number

      Size of the chunk.

    Returns this

  • Sets the maximal size of the socket message.

    Parameters

    • maxMessageSize: number

      Maximal message size.

    Returns this