@libp2p/http
    Preparing search index...

    Interface WebSocketRouteOptions

    Options used to define a HTTP route that can handle requests

    interface WebSocketRouteOptions {
        cors?: boolean;
        fallback?: HTTPRequestHandler;
        maxMessageSize?: number;
        method?: string | string[];
        path?: string;
    }

    Hierarchy (View Summary)

    Index

    Properties

    cors?: boolean

    By default all handlers support CORS headers, pass false here to disallow access to fetch requests.

    true
    

    If the request does not have a Connection: upgrade header, pass a fallback here to handle the request normally, otherwise the request will be rejected with a 400 error.

    maxMessageSize?: number

    The maximum message size to be sent or received over the socket in bytes

    10_485_760
    
    method?: string | string[]

    A list of HTTP verbs this handler will respond to. If the handler is found but the request method is not present a 405 will be returned.

    ['GET']
    
    path?: string

    Specify a path to serve the protocol from. If omitted the protocol name will be used.

    Paths can be looked up from the protocol map using getProtocolMap() or by making a GET request to /.well-known/libp2p/protocols.