@eleven-am/pondsocket 0.1.201 → 0.1.203
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +2 -0
- package/index.js +3 -0
- package/package.json +1 -1
- package/types.d.ts +34 -0
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RedisDistributedBackend = void 0;
|
|
3
4
|
const server_1 = require("./server/server");
|
|
5
|
+
var distributor_1 = require("./abstracts/distributor");
|
|
6
|
+
Object.defineProperty(exports, "RedisDistributedBackend", { enumerable: true, get: function () { return distributor_1.RedisDistributedBackend; } });
|
|
4
7
|
exports.default = server_1.PondSocket;
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -29,6 +29,15 @@ export type LeaveCallback<EventTypes extends PondEventMap = PondEventMap, Presen
|
|
|
29
29
|
|
|
30
30
|
export type RequestHandler<Request> = (request: Request) => void | Promise<void>;
|
|
31
31
|
|
|
32
|
+
export interface RedisDistributedBackendOptions {
|
|
33
|
+
host?: string;
|
|
34
|
+
port?: number;
|
|
35
|
+
password?: string;
|
|
36
|
+
database?: number;
|
|
37
|
+
url?: string;
|
|
38
|
+
keyPrefix?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
32
41
|
export interface PondSocketOptions {
|
|
33
42
|
server?: HTTPServer;
|
|
34
43
|
socketServer?: WebSocketServer;
|
|
@@ -658,3 +667,28 @@ export class OutgoingContext<
|
|
|
658
667
|
*/
|
|
659
668
|
transform(payload: PondMessage): OutgoingContext<Path, PresenceType, AssignType>;
|
|
660
669
|
}
|
|
670
|
+
|
|
671
|
+
export declare class RedisDistributedBackend implements IDistributedBackend {
|
|
672
|
+
constructor(options?: RedisDistributedBackendOptions);
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* @desc Gets the subject for subscribing to distributed messages
|
|
676
|
+
* @param endpointName - The name of the endpoint to subscribe to
|
|
677
|
+
* @param channelName - The name of the channel to subscribe to
|
|
678
|
+
* @param message - The message to send
|
|
679
|
+
*/
|
|
680
|
+
broadcast (endpointName: string, channelName: string, message: DistributedChannelMessage): Promise<void>;
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* @desc Cleans up the distributed backend, closing any connections and cleaning up resources
|
|
684
|
+
*/
|
|
685
|
+
cleanup (): Promise<void>;
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* @desc Subscribe to messages for a specific endpoint and channel
|
|
689
|
+
* @param endpointName - The name of the endpoint to subscribe to
|
|
690
|
+
* @param channelName - The name of the channel to subscribe to
|
|
691
|
+
* @param handler - The handler function to call when a message is received
|
|
692
|
+
*/
|
|
693
|
+
subscribe (endpointName: string, channelName: string, handler: (message: DistributedChannelMessage) => void): Unsubscribe;
|
|
694
|
+
}
|