Documentation
    Preparing search index...

    Function WebSocketRoute

    • WebSocket route decorator.

      @WebSocketRoute() is a route decorator function for WebSocket routes. If you want to define a WebSocket route with this @WebSocketRoute decorator, please don't forget to call the WebSocketAdaptor.upgrade function to the INestApplication instance.

      Also, WebSocketRoute is a module containing parameter decorator functions of below for the @WebSocketRoute decorated method, at the same time. Note that, every parameters must be decorated by one of the parameter decorators in the WebSocketRoute module. One thing more important is, WebSocketRoute.Acceptor decorated parameter must be defined in the method. If not, it would be both compilation/runtime error.

      For reference, key difference between @WebSocketGateway() of NestJS and @WebSocketRoute() of Nestia is, @WebSocketRoute() can make multiple WebSocket routes by configuring paths, besides @WebSocketGateway() can't do it.

      Furthermore, if you build SDK (Software Development Kit) library through @nestia/sdk, you can make safe WebSocket client taking advantages of TypeScript type hints and checks.

      Parameters

      • Optionalpath: string | string[]

        Path(s) of the WebSocket request

      Returns MethodDecorator

      Method decorator

      Jeongho Nam - https://github.com/samchon

      contracts/common.md#principled-implementation The decorator records the route paths as metadata on the method, with an empty list for no path, and the adapter reads that metadata to build the route table.

      contracts/common.md#clear-and-simple-design One decorator function that writes one metadata object.

      contracts/common.md#prohibited-implementation-shortcuts It uses the reflect metadata API and does not touch the server.

      contracts/common.md#meaningful-documentation The comment documents the path forms and the required parameters.

      contracts/portability.md#os-neutral-implementation The route and parameter metadata describe WebSocket handshakes and HTTP URL fields; native files and processes are not represented.