• Route decorator for WebSocket routes. Can be used to register WebSocket routes. This annotation can be used for methods and classes.

    Supported Decorators:

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

    Parameters

    • method: string

      The HTTP method for the route.

    • Optional baseRoute: string

      The base route path 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
        • Optional propertyKey: string

        Returns any

    Example

    Preparations for a simple login route: This method can be called by sending a message using method auth.login. The response (return value of the method) is sent to the client using m.auth.login.

    @Route("auth")
    class Auth {
    @Route("login")
    async login(credentials: any, connection: WebsocketConnection): Promise<any> {
    // check authentication for provided credentials.
    if (authenticated)
    return true;
    else
    return false;
    }
    }

Generated using TypeDoc