Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SocketMixin<API, Loc>

Mixin for shared socket functionality between the server and client.

Type parameters

Hierarchy

Index

Properties

Protected Abstract socketHandlers

socketHandlers: any

Expected by the mixin.

Private waiters

waiters: object
internal

Type declaration

  • [event: string]: object
    • [startTime: number]: object
      • reject: Function
      • resolve: Function
      • timeoutId: any

Methods

blockEvent

  • blockEvent<Event>(event: Event, timeout?: number): Promise<any>
  • Gives the ability to block and wait for an event. Usage: await this.blockEvent('some-event');

    Type parameters

    • Event: string

    Parameters

    • event: Event
    • Default value timeout: number = 5000

    Returns Promise<any>

Protected handleEvent

  • handleEvent(ctx: unknown, event: string, ...args: any[]): void
  • Processes an incoming event with the appropriate socketHandler. If the handler returns an EventResponse, the proper event will automatically be emitted.

    Parameters

    • ctx: unknown
    • event: string
    • Rest ...args: any[]

    Returns void

Protected Abstract reply

  • reply(ctx: any, response: Response<string, API[Loc], Loc>): any
  • Handles a Response that requires a reply.

    Parameters

    • ctx: any
    • response: Response<string, API[Loc], Loc>

    Returns any

Generated using TypeDoc