kaios-types
    Preparing search index...

    Interface UDPSocket

    Represents a UDP socket. Requires "dom.udpsocket.enabled" system preference. Requires "udp-socket" permission.

    interface UDPSocket {
        addressReuse: boolean;
        closed: Promise<void>;
        localAddress?: string;
        localPort?: number;
        loopback: boolean;
        onmessage: EventHandler;
        opened: Promise<void>;
        readyState: SocketReadyState;
        remoteAddress?: string;
        remotePort?: number;
        addEventListener(
            type: string,
            callback: EventListenerOrEventListenerObject | null,
            options?: boolean | AddEventListenerOptions,
        ): void;
        close(): Promise<void>;
        dispatchEvent(event: Event): boolean;
        joinMulticastGroup(multicastGroupAddress: string): void;
        leaveMulticastGroup(multicastGroupAddress: string): void;
        removeEventListener(
            type: string,
            callback: EventListenerOrEventListenerObject | null,
            options?: boolean | EventListenerOptions,
        ): void;
        send(
            data: string | Blob | ArrayBuffer | ArrayBufferView<ArrayBuffer>,
            remoteAddress?: string,
            remotePort?: number,
        ): boolean;
    }

    Hierarchy

    • EventTarget
      • UDPSocket
    Index

    Properties

    addressReuse: boolean

    Whether address reuse is enabled.

    closed: Promise<void>

    Promise resolving when the socket is closed.

    localAddress?: string

    The local address bound to the socket.

    localPort?: number

    The local port bound to the socket.

    loopback: boolean

    Whether loopback is enabled.

    onmessage: EventHandler

    Event handler for incoming messages. Bug 1056444: use event interface before Stream API is ready

    opened: Promise<void>

    Promise resolving when the socket is opened.

    readyState: SocketReadyState

    The current state of the socket.

    remoteAddress?: string

    The remote address the socket is connected to.

    remotePort?: number

    The remote port the socket is connected to.

    Methods

    • The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.

      MDN Reference

      Parameters

      • type: string
      • callback: EventListenerOrEventListenerObject | null
      • Optionaloptions: boolean | AddEventListenerOptions

      Returns void

    • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.

      MDN Reference

      Parameters

      • event: Event

      Returns boolean

    • Joins a multicast group.

      Parameters

      • multicastGroupAddress: string

        The address of the multicast group to join.

      Returns void

    • Leaves a multicast group.

      Parameters

      • multicastGroupAddress: string

        The address of the multicast group to leave.

      Returns void

    • The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.

      MDN Reference

      Parameters

      • type: string
      • callback: EventListenerOrEventListenerObject | null
      • Optionaloptions: boolean | EventListenerOptions

      Returns void

    • Sends data over the socket.

      Parameters

      • data: string | Blob | ArrayBuffer | ArrayBufferView<ArrayBuffer>

        The data to send.

      • OptionalremoteAddress: string

        Optional remote address if not connected.

      • OptionalremotePort: number

        Optional remote port if not connected.

      Returns boolean

      True if sent successfully.