screeps-api
    Preparing search index...

    Interface SocketEvent

    Parsed version of a message received from the server via the WebSocket API.

    Unless you are writing code that genuinely should be able to process any Screeps WebSocket API event, this type should not be used directly. Instead, extend the interface and define stricter types for these fields. If you do create a sub-interface, please consider submitting a PR.

    interface SocketEvent {
        data: unknown;
        id?: string;
        path: string;
        type: string;
    }

    Hierarchy (View Summary)

    Index

    Properties

    Properties

    data: unknown

    The event payload. Extensions of this interface should specify a more precise type.

    id?: string

    ID of the entity the event is reporting on. Undefined when type is server.

    Examples:

    • User ID for user events
    • Room name (shard0/W0N0, W0N0, etc) for room events
    path: string

    When non-empty, indicates that the event concerns a property or aspect of type.

    Examples:

    • /resources for user-type events indicates an update to resource counts
    type: string