1 | /// <reference types="node" />
|
2 | import * as http from 'http';
|
3 | import { ContributionProvider, MaybePromise } from '../common';
|
4 | /**
|
5 | * Bind components to this symbol to filter WebSocket connections.
|
6 | */
|
7 | export declare const WsRequestValidatorContribution: unique symbol;
|
8 | export interface WsRequestValidatorContribution {
|
9 | /**
|
10 | * Return `false` to prevent the protocol upgrade from going through, blocking the WebSocket connection.
|
11 | *
|
12 | * @param request The HTTP connection upgrade request received by the server.
|
13 | */
|
14 | allowWsUpgrade(request: http.IncomingMessage): MaybePromise<boolean>;
|
15 | }
|
16 | /**
|
17 | * Central handler of `WsRequestValidatorContribution`.
|
18 | */
|
19 | export declare class WsRequestValidator {
|
20 | protected readonly requestValidators: ContributionProvider<WsRequestValidatorContribution>;
|
21 | /**
|
22 | * Ask all bound `WsRequestValidatorContributions` if the WebSocket connection should be allowed or not.
|
23 | */
|
24 | allowWsUpgrade(request: http.IncomingMessage): Promise<boolean>;
|
25 | }
|
26 | //# sourceMappingURL=ws-request-validators.d.ts.map |
\ | No newline at end of file |