hammerspoon2-docs
    Preparing search index...

    Class HSWebSocketConnection

    A WebSocket connection to a single client, passed to the callback registered with server.setWebSocketCallback(). Use send() to push messages to the connected client and close() to end the connection. Do not instantiate HSWebSocketConnection directly — it is created by the server when a client performs a WebSocket upgrade.

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    identifier: string

    A unique identifier for this connection (UUID string).

    Methods

    • Close the WebSocket connection to the client. Sends a WebSocket close frame and cancels the underlying TCP connection.

      Returns void

    • Destroy this connection object, releasing all resources.

      Returns void

    • Send a text message to the connected WebSocket client.

      Parameters

      • message: string

        The text message to send.

      Returns void