MCPcopy
hub / github.com/soketi/soketi / AdapterInterface

Interface AdapterInterface

src/adapters/adapter-interface.ts:7–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5const Discover = require('node-discover');
6
7export interface AdapterInterface {
8 /**
9 * The app connections storage class to manage connections.
10 */
11 namespaces?: Map<string, Namespace>;
12
13 /**
14 * The list of nodes in the current private network.
15 */
16 driver?: AdapterInterface;
17
18 /**
19 * Initialize the adapter.
20 */
21 init(): Promise<AdapterInterface>;
22
23 /**
24 * Get the app namespace.
25 */
26 getNamespace(appId: string): Namespace;
27
28 /**
29 * Get all namespaces.
30 */
31 getNamespaces(): Map<string, Namespace>;
32
33 /**
34 * Add a new socket to the namespace.
35 */
36 addSocket(appId: string, ws: WebSocket): Promise<boolean>;
37
38 /**
39 * Remove a socket from the namespace.
40 */
41 removeSocket(appId: string, wsId: string): Promise<boolean>;
42
43 /**
44 * Add a socket ID to the channel identifier.
45 * Return the total number of connections after the connection.
46 */
47 addToChannel(appId: string, channel: string, ws: WebSocket): Promise<number>;
48
49 /**
50 * Remove a socket ID from the channel identifier.
51 * Return the total number of connections remaining to the channel.
52 */
53 removeFromChannel(appId: string, channel: string|string[], wsId: string): Promise<number|void>;
54
55 /**
56 * Send a message to a namespace and channel.
57 */
58 send(appId: string, channel: string, data: string, exceptingId?: string|null): any;
59
60 /**
61 * Terminate an User ID's connections.
62 */
63 terminateUserConnections(appId: string, userId: number|string): void;
64

Callers 104

setAdapterMethod · 0.65
initMethod · 0.65
getNamespaceMethod · 0.65
public.test.tsFile · 0.65
presence.test.tsFile · 0.65
private.test.tsFile · 0.65
closeAllLocalSocketsMethod · 0.65
getNamespacesMethod · 0.65
onOpenMethod · 0.65
subscribeToChannelMethod · 0.65

Implementers 2

LocalAdaptersrc/adapters/local-adapter.ts
Adaptersrc/adapters/adapter.ts

Calls

no outgoing calls

Tested by

no test coverage detected