@eleven-am/pondsocket 0.1.25 → 0.1.27
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/client/channel.js +2 -2
- package/package.json +1 -1
- package/server/endpoint/endpoint.test.js +0 -1
- package/types.d.ts +3 -2
package/client/channel.js
CHANGED
|
@@ -50,7 +50,7 @@ class Channel {
|
|
|
50
50
|
* @param event - The event to monitor.
|
|
51
51
|
* @param callback - The callback to call when a message is received.
|
|
52
52
|
*/
|
|
53
|
-
|
|
53
|
+
onMessageEvent(event, callback) {
|
|
54
54
|
return this._receiver.subscribe((data) => {
|
|
55
55
|
if (data.action === enums_1.ServerActions.BROADCAST && data.event === event && data.channelName === this._name) {
|
|
56
56
|
return callback(data.payload);
|
|
@@ -61,7 +61,7 @@ class Channel {
|
|
|
61
61
|
* @desc Monitors the channel for messages.
|
|
62
62
|
* @param callback - The callback to call when a message is received.
|
|
63
63
|
*/
|
|
64
|
-
|
|
64
|
+
onMessage(callback) {
|
|
65
65
|
return this._receiver.subscribe((data) => {
|
|
66
66
|
if (data.action === enums_1.ServerActions.BROADCAST && data.channelName === this._name) {
|
|
67
67
|
return callback(data.event, data.payload);
|
package/package.json
CHANGED
|
@@ -139,7 +139,6 @@ describe('endpoint', () => {
|
|
|
139
139
|
event: 'TEST',
|
|
140
140
|
payload: {},
|
|
141
141
|
};
|
|
142
|
-
console.log(JSON.stringify(message, null, 2));
|
|
143
142
|
const { socket, server, createPondChannel } = createPondSocket();
|
|
144
143
|
expect(server).toBeDefined();
|
|
145
144
|
const endpoint = socket.createEndpoint('/api/:room', (_, res) => {
|
package/types.d.ts
CHANGED
|
@@ -129,13 +129,13 @@ export declare class Channel {
|
|
|
129
129
|
* @param event - The event to monitor.
|
|
130
130
|
* @param callback - The callback to call when a message is received.
|
|
131
131
|
*/
|
|
132
|
-
public
|
|
132
|
+
public onMessageEvent(event: string, callback: (message: PondMessage) => void): Unsubscribe;
|
|
133
133
|
|
|
134
134
|
/**
|
|
135
135
|
* @desc Monitors the channel for messages.
|
|
136
136
|
* @param callback - The callback to call when a message is received.
|
|
137
137
|
*/
|
|
138
|
-
public
|
|
138
|
+
public onMessage(callback: (event: string, message: PondMessage) => void): Unsubscribe;
|
|
139
139
|
|
|
140
140
|
/**
|
|
141
141
|
* @desc Monitors the connection state of the channel.
|
|
@@ -538,3 +538,4 @@ declare class PondSocket {
|
|
|
538
538
|
* @constructor
|
|
539
539
|
*/
|
|
540
540
|
declare const PondSocketFromExpress: (app: Express) => PondSocketExpressApp;
|
|
541
|
+
|