WxPayload: { d: unknown; f: number; m: number; p: string }

Payload sendable to a WxEnd

Type declaration

  • d: unknown

    Data payload.

    This is anything transferrable by the underlying messaging channel. For example, for Workers, this is any transferreable object. For web requests, this should probably be something seraializable to JSON.

  • f: number

    Function identifier.

    This is a unique identifier inside the protocol that identifies the function that is being called by RPC. For response messages, this indicates if the response is a return (0) or catch (1)

    Functions 0-31 are reserved for internal use in workex library

  • m: number

    Message identifier.

    This is a serial number generated per RPC call to route the returned response to the promise that is waiting for it.

    Messages 0-99 are reserved for internal use. Regular RPC calls will start from 100. Note that the first few messages are used to register the buses

  • p: string

    The protocol identifier. Listeners on the other side maybe use this identifier to choose if they should handle or ignore the payload

    The protocol "workex" is reserved for internal communication