UNPKG

1.39 kBTypeScriptView Raw
1import { Socket } from 'socket.io';
2import { Channel } from '../../common/message-rpc/channel';
3export interface MessagingService {
4 /**
5 * Accept a web socket channel on the given path.
6 * A path supports the route syntax: https://github.com/rcs/route-parser#what-can-i-use-in-my-routes.
7 */
8 wsChannel(path: string, callback: (params: MessagingService.PathParams, channel: Channel) => void): void;
9 /**
10 * Accept a web socket connection on the given path.
11 * A path supports the route syntax: https://github.com/rcs/route-parser#what-can-i-use-in-my-routes.
12 *
13 * #### Important
14 * Prefer using web socket channels over establishing new web socket connection. Clients can handle only limited amount of web sockets
15 * and excessive amount can cause performance degradation. All web socket channels share a single web socket connection.
16 */
17 ws(path: string, callback: (params: MessagingService.PathParams, socket: Socket) => void): void;
18}
19export declare namespace MessagingService {
20 /** Inversify container identifier for the `MessagingService` component. */
21 const Identifier: unique symbol;
22 interface PathParams {
23 [name: string]: string;
24 }
25 const Contribution: unique symbol;
26 interface Contribution {
27 configure(service: MessagingService): void;
28 }
29}
30//# sourceMappingURL=messaging-service.d.ts.map
\No newline at end of file