UNPKG

1.22 kBTypeScriptView Raw
1/// <reference types="node" />
2import { ContributionProvider, MaybePromise } from '../../common';
3import { Socket } from 'socket.io';
4import * as http from 'http';
5/**
6 * Bind components to this symbol to subscribe to WebSocket events.
7 */
8export declare const MessagingListenerContribution: unique symbol;
9export interface MessagingListenerContribution {
10 /**
11 * Function invoked when a HTTP connection is upgraded to a websocket.
12 *
13 * @param request The HTTP connection upgrade request received by the server.
14 * @param socket The WebSocket that the connection was upgraded to.
15 */
16 onDidWebSocketUpgrade(request: http.IncomingMessage, socket: Socket): MaybePromise<void>;
17}
18/**
19 * Handler of Theia messaging system events, dispatching to MessagingListenerContribution instances.
20 */
21export declare class MessagingListener {
22 protected readonly messagingListenerContributions: ContributionProvider<MessagingListenerContribution>;
23 /**
24 * Notify all the subscribed `MessagingListenerContribution`s that the Websocket was upgraded.
25 */
26 onDidWebSocketUpgrade(request: http.IncomingMessage, socket: Socket): Promise<void>;
27}
28//# sourceMappingURL=messaging-listeners.d.ts.map
\No newline at end of file