An IPC router. This must be constructed to send and recieve IPC events.

Constructors

  • Parameters

    • uid: string

      A unique ID for this router. If another router has the same ID, it may cause problems. Must be less characters than MAX_ROUTER_UID_LENGTH.

    Returns Router

    Throws if the UID is invalid.

Properties

uid: string

A unique ID for this router. If another router has the same ID, it may cause problems. Must be less characters than MAX_ROUTER_UID_LENGTH.

Accessors

  • get isValid(): boolean
  • Has this object been destroyed?

    Returns boolean

Methods

  • Unsubscribe from all Minecraft events and mark this object as invalid.

    Returns void

  • Send or stream a two-way IPC event. If the payload is greater than the max length then it will be streamed.

    Parameters

    Returns Promise<SerializableValue>

    Returns whatever the target listener returns.

    Throws if a response is not recieved within 20 game ticks (after the entire payload has been streamed).

  • Stream a two-way IPC event. The payload has no max length since it is streamed.

    Parameters

    Returns Promise<SerializableValue>

    Returns whatever the listener returns.

    Throws if a response is not recieved within 20 game ticks (after the entire payload has been streamed).

    Throws if the message is too long.

  • Registers an IPC listener.

    Parameters

    Returns void

    Throws if another listener is registered with the same ID.

  • Removes a listener for an event.

    Parameters

    • event: string

      The event ID.

    Returns boolean

    Returns a boolean indicating whether the listener was removed or not.

  • Send a one-way IPC event.

    Parameters

    Returns void

    Throws if the message is too long.

  • Send or stream a one-way IPC event. If the payload is greater than the max length then it will be streamed.

    Parameters

    Returns Promise<void>

  • Stream a one-way IPC event. The payload has no max length, since it is streamed.

    Parameters

    Returns Promise<void>