Function StandaloneRoute

  • StandaloneRoute decorator for WebSocket routes. Can be used to register Standalone WebSocket routes. This annotation can be used for methods only.

    Supported Decorators:

    • @Auth
    • @Modifies and @ModifiesFor
    • @ModifiesAuthentication

    Parameters

    • method: string

      The HTTP method for the route.

    • Optional modifiesAuthentication: boolean

      Indicates if the route modifies authentication. If true all Websocket Outbounds with tag will be re-sent automatically.

    Returns ((target, propertyKey) => any)

    • The decorator function.
      • (target, propertyKey): any
      • Parameters

        • target: any
        • propertyKey: string

        Returns any

    Example

    Preparations for a simple standalone message route: This method can be called by sending a message using method example.insert. The response (return value of the method, ex: insertId) is sent to the client using m.example.insert.

    class Example {
    @StandaloneRoute("example.insert")
    async insert(data: any, connection: WebsocketConnection): Promise<any> {
    // process data
    return insertId;
    }
    }

Generated using TypeDoc