@supabase/realtime-js 1.6.2 → 1.7.0
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/dist/main/RealtimeChannel.d.ts +12 -3
- package/dist/main/RealtimeChannel.d.ts.map +1 -1
- package/dist/main/RealtimeChannel.js +18 -10
- package/dist/main/RealtimeChannel.js.map +1 -1
- package/dist/main/RealtimeClient.d.ts +29 -9
- package/dist/main/RealtimeClient.d.ts.map +1 -1
- package/dist/main/RealtimeClient.js +44 -26
- package/dist/main/RealtimeClient.js.map +1 -1
- package/dist/main/RealtimePresence.d.ts +12 -8
- package/dist/main/RealtimePresence.d.ts.map +1 -1
- package/dist/main/RealtimePresence.js +12 -8
- package/dist/main/RealtimePresence.js.map +1 -1
- package/dist/main/lib/constants.d.ts +6 -0
- package/dist/main/lib/constants.d.ts.map +1 -1
- package/dist/main/lib/constants.js +8 -1
- package/dist/main/lib/constants.js.map +1 -1
- package/dist/main/lib/version.d.ts +1 -1
- package/dist/main/lib/version.js +1 -1
- package/dist/module/RealtimeChannel.d.ts +12 -3
- package/dist/module/RealtimeChannel.d.ts.map +1 -1
- package/dist/module/RealtimeChannel.js +18 -10
- package/dist/module/RealtimeChannel.js.map +1 -1
- package/dist/module/RealtimeClient.d.ts +29 -9
- package/dist/module/RealtimeClient.d.ts.map +1 -1
- package/dist/module/RealtimeClient.js +45 -27
- package/dist/module/RealtimeClient.js.map +1 -1
- package/dist/module/RealtimePresence.d.ts +12 -8
- package/dist/module/RealtimePresence.d.ts.map +1 -1
- package/dist/module/RealtimePresence.js +12 -8
- package/dist/module/RealtimePresence.js.map +1 -1
- package/dist/module/lib/constants.d.ts +6 -0
- package/dist/module/lib/constants.d.ts.map +1 -1
- package/dist/module/lib/constants.js +7 -0
- package/dist/module/lib/constants.js.map +1 -1
- package/dist/module/lib/version.d.ts +1 -1
- package/dist/module/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/RealtimeChannel.ts +29 -25
- package/src/RealtimeClient.ts +66 -34
- package/src/RealtimePresence.ts +12 -8
- package/src/lib/constants.ts +7 -0
- package/src/lib/version.ts +1 -1
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export default class RealtimePresence {
|
|
6
6
|
/**
|
|
7
|
-
* Initializes the Presence
|
|
7
|
+
* Initializes the Presence.
|
|
8
|
+
*
|
|
8
9
|
* @param channel - The RealtimeSubscription
|
|
9
10
|
* @param opts - The options,
|
|
10
11
|
* for example `{events: {state: 'state', diff: 'diff'}}`
|
|
@@ -45,9 +46,11 @@ export default class RealtimePresence {
|
|
|
45
46
|
});
|
|
46
47
|
}
|
|
47
48
|
/**
|
|
48
|
-
* Used to sync the list of presences on the server
|
|
49
|
-
*
|
|
50
|
-
*
|
|
49
|
+
* Used to sync the list of presences on the server with the
|
|
50
|
+
* client's state.
|
|
51
|
+
*
|
|
52
|
+
* An optional `onJoin` and `onLeave` callback can be provided to
|
|
53
|
+
* react to changes in the client's local presences across
|
|
51
54
|
* disconnects and reconnects with the server.
|
|
52
55
|
*/
|
|
53
56
|
static syncState(currentState, newState, onJoin, onLeave) {
|
|
@@ -81,11 +84,12 @@ export default class RealtimePresence {
|
|
|
81
84
|
return this.syncDiff(state, { joins, leaves }, onJoin, onLeave);
|
|
82
85
|
}
|
|
83
86
|
/**
|
|
87
|
+
* Used to sync a diff of presence join and leave events from the
|
|
88
|
+
* server, as they happen.
|
|
84
89
|
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* joining or leaving from a device.
|
|
90
|
+
* Like `syncState`, `syncDiff` accepts optional `onJoin` and
|
|
91
|
+
* `onLeave` callbacks to react to a user joining or leaving from a
|
|
92
|
+
* device.
|
|
89
93
|
*/
|
|
90
94
|
static syncDiff(state, diff, onJoin, onLeave) {
|
|
91
95
|
const { joins, leaves } = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RealtimePresence.js","sourceRoot":"","sources":["../../src/RealtimePresence.ts"],"names":[],"mappings":"AAAA;;;EAGE;AAuCF,MAAM,CAAC,OAAO,OAAO,gBAAgB;IAcnC
|
|
1
|
+
{"version":3,"file":"RealtimePresence.js","sourceRoot":"","sources":["../../src/RealtimePresence.ts"],"names":[],"mappings":"AAAA;;;EAGE;AAuCF,MAAM,CAAC,OAAO,OAAO,gBAAgB;IAcnC;;;;;;OAMG;IACH,YAAmB,OAAwB,EAAE,IAAmB;QAA7C,YAAO,GAAP,OAAO,CAAiB;QApB3C,UAAK,GAAkB,EAAE,CAAA;QACzB,iBAAY,GAAsB,EAAE,CAAA;QACpC,YAAO,GAAkB,IAAI,CAAA;QAC7B,WAAM,GAIF;YACF,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;YAChB,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;YACjB,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;SACjB,CAAA;QAUC,MAAM,MAAM,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,KAAI;YAC7B,KAAK,EAAE,gBAAgB;YACvB,IAAI,EAAE,eAAe;SACtB,CAAA;QAED,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,EAAE,CAAC,QAA0B,EAAE,EAAE;YAC/D,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAA;YAE/C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAA;YAErC,IAAI,CAAC,KAAK,GAAG,gBAAgB,CAAC,SAAS,CACrC,IAAI,CAAC,KAAK,EACV,QAAQ,EACR,MAAM,EACN,OAAO,CACR,CAAA;YAED,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBACjC,IAAI,CAAC,KAAK,GAAG,gBAAgB,CAAC,QAAQ,CACpC,IAAI,CAAC,K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"}
|
|
@@ -28,4 +28,10 @@ export declare enum CHANNEL_EVENTS {
|
|
|
28
28
|
export declare enum TRANSPORTS {
|
|
29
29
|
websocket = "websocket"
|
|
30
30
|
}
|
|
31
|
+
export declare enum CONNECTION_STATE {
|
|
32
|
+
Connecting = "connecting",
|
|
33
|
+
Open = "open",
|
|
34
|
+
Closing = "closing",
|
|
35
|
+
Closed = "closed"
|
|
36
|
+
}
|
|
31
37
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe;;CAAgD,CAAA;AAE5E,eAAO,MAAM,GAAG,EAAE,MAAgB,CAAA;AAElC,eAAO,MAAM,eAAe,QAAQ,CAAA;AAEpC,eAAO,MAAM,eAAe,OAAO,CAAA;AAEnC,oBAAY,aAAa;IACvB,UAAU,IAAI;IACd,IAAI,IAAI;IACR,OAAO,IAAI;IACX,MAAM,IAAI;CACX;AAED,oBAAY,cAAc;IACxB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,OAAO,YAAY;CACpB;AAED,oBAAY,cAAc;IACxB,KAAK,cAAc;IACnB,KAAK,cAAc;IACnB,IAAI,aAAa;IACjB,KAAK,cAAc;IACnB,KAAK,cAAc;IACnB,YAAY,iBAAiB;CAC9B;AAED,oBAAY,UAAU;IACpB,SAAS,cAAc;CACxB"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe;;CAAgD,CAAA;AAE5E,eAAO,MAAM,GAAG,EAAE,MAAgB,CAAA;AAElC,eAAO,MAAM,eAAe,QAAQ,CAAA;AAEpC,eAAO,MAAM,eAAe,OAAO,CAAA;AAEnC,oBAAY,aAAa;IACvB,UAAU,IAAI;IACd,IAAI,IAAI;IACR,OAAO,IAAI;IACX,MAAM,IAAI;CACX;AAED,oBAAY,cAAc;IACxB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,OAAO,YAAY;CACpB;AAED,oBAAY,cAAc;IACxB,KAAK,cAAc;IACnB,KAAK,cAAc;IACnB,IAAI,aAAa;IACjB,KAAK,cAAc;IACnB,KAAK,cAAc;IACnB,YAAY,iBAAiB;CAC9B;AAED,oBAAY,UAAU;IACpB,SAAS,cAAc;CACxB;AAED,oBAAY,gBAAgB;IAC1B,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB"}
|
|
@@ -31,4 +31,11 @@ export var TRANSPORTS;
|
|
|
31
31
|
(function (TRANSPORTS) {
|
|
32
32
|
TRANSPORTS["websocket"] = "websocket";
|
|
33
33
|
})(TRANSPORTS || (TRANSPORTS = {}));
|
|
34
|
+
export var CONNECTION_STATE;
|
|
35
|
+
(function (CONNECTION_STATE) {
|
|
36
|
+
CONNECTION_STATE["Connecting"] = "connecting";
|
|
37
|
+
CONNECTION_STATE["Open"] = "open";
|
|
38
|
+
CONNECTION_STATE["Closing"] = "closing";
|
|
39
|
+
CONNECTION_STATE["Closed"] = "closed";
|
|
40
|
+
})(CONNECTION_STATE || (CONNECTION_STATE = {}));
|
|
34
41
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,eAAe,EAAE,eAAe,OAAO,EAAE,EAAE,CAAA;AAE5E,MAAM,CAAC,MAAM,GAAG,GAAW,OAAO,CAAA;AAElC,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAA;AAEpC,MAAM,CAAC,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;AAED,MAAM,CAAN,IAAY,cAMX;AAND,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,qCAAmB,CAAA;IACnB,mCAAiB,CAAA;IACjB,qCAAmB,CAAA;IACnB,qCAAmB,CAAA;AACrB,CAAC,EANW,cAAc,KAAd,cAAc,QAMzB;AAED,MAAM,CAAN,IAAY,cAOX;AAPD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,qCAAmB,CAAA;IACnB,mCAAiB,CAAA;IACjB,qCAAmB,CAAA;IACnB,qCAAmB,CAAA;IACnB,+CAA6B,CAAA;AAC/B,CAAC,EAPW,cAAc,KAAd,cAAc,QAOzB;AAED,MAAM,CAAN,IAAY,UAEX;AAFD,WAAY,UAAU;IACpB,qCAAuB,CAAA;AACzB,CAAC,EAFW,UAAU,KAAV,UAAU,QAErB;AAED,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,6CAAyB,CAAA;IACzB,iCAAa,CAAA;IACb,uCAAmB,CAAA;IACnB,qCAAiB,CAAA;AACnB,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "1.
|
|
1
|
+
export declare const version = "1.7.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = '1.
|
|
1
|
+
export const version = '1.7.0';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
package/src/RealtimeChannel.ts
CHANGED
|
@@ -108,36 +108,40 @@ export default class RealtimeChannel {
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Registers a callback that will be executed when the channel closes.
|
|
113
|
+
*/
|
|
111
114
|
onClose(callback: Function) {
|
|
112
115
|
this.on(CHANNEL_EVENTS.close, {}, callback)
|
|
113
116
|
}
|
|
114
117
|
|
|
118
|
+
/**
|
|
119
|
+
* Registers a callback that will be executed when the channel encounteres an error.
|
|
120
|
+
*/
|
|
115
121
|
onError(callback: Function) {
|
|
116
122
|
this.on(CHANNEL_EVENTS.error, {}, (reason: string) => callback(reason))
|
|
117
123
|
}
|
|
118
124
|
|
|
119
|
-
on(
|
|
120
|
-
type: string,
|
|
121
|
-
eventFilter?: { [key: string]: string },
|
|
122
|
-
callback?: Function
|
|
123
|
-
) {
|
|
125
|
+
on(type: string, filter?: { [key: string]: string }, callback?: Function) {
|
|
124
126
|
this.bindings.push({
|
|
125
127
|
type,
|
|
126
|
-
|
|
128
|
+
filter: filter ?? {},
|
|
127
129
|
callback: callback ?? (() => {}),
|
|
128
130
|
})
|
|
129
131
|
}
|
|
130
132
|
|
|
131
|
-
off(type: string,
|
|
133
|
+
off(type: string, filter: { [key: string]: any }) {
|
|
132
134
|
this.bindings = this.bindings.filter((bind) => {
|
|
133
135
|
return !(
|
|
134
|
-
bind.type === type &&
|
|
135
|
-
RealtimeChannel.isEqual(bind.eventFilter, eventFilter)
|
|
136
|
+
bind.type === type && RealtimeChannel.isEqual(bind.filter, filter)
|
|
136
137
|
)
|
|
137
138
|
})
|
|
138
139
|
}
|
|
139
140
|
|
|
140
|
-
|
|
141
|
+
/**
|
|
142
|
+
* Returns `true` if the socket is connected and the channel has been joined.
|
|
143
|
+
*/
|
|
144
|
+
canPush(): boolean {
|
|
141
145
|
return this.socket.isConnected() && this.isJoined()
|
|
142
146
|
}
|
|
143
147
|
|
|
@@ -161,7 +165,7 @@ export default class RealtimeChannel {
|
|
|
161
165
|
}
|
|
162
166
|
|
|
163
167
|
/**
|
|
164
|
-
* Leaves the channel
|
|
168
|
+
* Leaves the channel.
|
|
165
169
|
*
|
|
166
170
|
* Unsubscribes from server events, and instructs channel to terminate on server.
|
|
167
171
|
* Triggers onClose() hooks.
|
|
@@ -169,16 +173,16 @@ export default class RealtimeChannel {
|
|
|
169
173
|
* To receive leave acknowledgements, use the a `receive` hook to bind to the server ack, ie:
|
|
170
174
|
* channel.unsubscribe().receive("ok", () => alert("left!") )
|
|
171
175
|
*/
|
|
172
|
-
unsubscribe(timeout = this.timeout) {
|
|
176
|
+
unsubscribe(timeout = this.timeout): Push {
|
|
173
177
|
this.state = CHANNEL_STATES.leaving
|
|
174
|
-
|
|
178
|
+
const onClose = () => {
|
|
175
179
|
this.socket.log('channel', `leave ${this.topic}`)
|
|
176
180
|
this.trigger(CHANNEL_EVENTS.close, 'leave', this.joinRef())
|
|
177
181
|
}
|
|
178
182
|
// Destroy joinPush to avoid connection timeouts during unscription phase
|
|
179
183
|
this.joinPush.destroy()
|
|
180
184
|
|
|
181
|
-
|
|
185
|
+
const leavePush = new Push(this, CHANNEL_EVENTS.leave, {}, timeout)
|
|
182
186
|
leavePush.receive('ok', () => onClose()).receive('timeout', () => onClose())
|
|
183
187
|
leavePush.send()
|
|
184
188
|
if (!this.canPush()) {
|
|
@@ -198,15 +202,15 @@ export default class RealtimeChannel {
|
|
|
198
202
|
return payload
|
|
199
203
|
}
|
|
200
204
|
|
|
201
|
-
isMember(topic: string) {
|
|
205
|
+
isMember(topic: string): boolean {
|
|
202
206
|
return this.topic === topic
|
|
203
207
|
}
|
|
204
208
|
|
|
205
|
-
joinRef() {
|
|
209
|
+
joinRef(): string {
|
|
206
210
|
return this.joinPush.ref
|
|
207
211
|
}
|
|
208
212
|
|
|
209
|
-
rejoin(timeout = this.timeout) {
|
|
213
|
+
rejoin(timeout = this.timeout): void {
|
|
210
214
|
if (this.isLeaving()) {
|
|
211
215
|
return
|
|
212
216
|
}
|
|
@@ -230,8 +234,8 @@ export default class RealtimeChannel {
|
|
|
230
234
|
.filter((bind) => {
|
|
231
235
|
return (
|
|
232
236
|
bind?.type === type &&
|
|
233
|
-
(bind?.
|
|
234
|
-
bind?.
|
|
237
|
+
(bind?.filter?.event === '*' ||
|
|
238
|
+
bind?.filter?.event === payload?.event)
|
|
235
239
|
)
|
|
236
240
|
})
|
|
237
241
|
.map((bind) => bind.callback(handledPayload, ref))
|
|
@@ -246,23 +250,23 @@ export default class RealtimeChannel {
|
|
|
246
250
|
})
|
|
247
251
|
}
|
|
248
252
|
|
|
249
|
-
replyEventName(ref: string) {
|
|
253
|
+
replyEventName(ref: string): string {
|
|
250
254
|
return `chan_reply_${ref}`
|
|
251
255
|
}
|
|
252
256
|
|
|
253
|
-
isClosed() {
|
|
257
|
+
isClosed(): boolean {
|
|
254
258
|
return this.state === CHANNEL_STATES.closed
|
|
255
259
|
}
|
|
256
|
-
isErrored() {
|
|
260
|
+
isErrored(): boolean {
|
|
257
261
|
return this.state === CHANNEL_STATES.errored
|
|
258
262
|
}
|
|
259
|
-
isJoined() {
|
|
263
|
+
isJoined(): boolean {
|
|
260
264
|
return this.state === CHANNEL_STATES.joined
|
|
261
265
|
}
|
|
262
|
-
isJoining() {
|
|
266
|
+
isJoining(): boolean {
|
|
263
267
|
return this.state === CHANNEL_STATES.joining
|
|
264
268
|
}
|
|
265
|
-
isLeaving() {
|
|
269
|
+
isLeaving(): boolean {
|
|
266
270
|
return this.state === CHANNEL_STATES.leaving
|
|
267
271
|
}
|
|
268
272
|
|
package/src/RealtimeClient.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
DEFAULT_TIMEOUT,
|
|
8
8
|
WS_CLOSE_NORMAL,
|
|
9
9
|
DEFAULT_HEADERS,
|
|
10
|
+
CONNECTION_STATE,
|
|
10
11
|
} from './lib/constants'
|
|
11
12
|
import Timer from './lib/timer'
|
|
12
13
|
import Serializer from './lib/serializer'
|
|
@@ -32,6 +33,11 @@ type Message = {
|
|
|
32
33
|
ref: string
|
|
33
34
|
}
|
|
34
35
|
|
|
36
|
+
type ChannelParams = {
|
|
37
|
+
selfBroadcast?: boolean
|
|
38
|
+
[key: string]: any
|
|
39
|
+
}
|
|
40
|
+
|
|
35
41
|
const noop = () => {}
|
|
36
42
|
|
|
37
43
|
export default class RealtimeClient {
|
|
@@ -66,9 +72,10 @@ export default class RealtimeClient {
|
|
|
66
72
|
error: [],
|
|
67
73
|
message: [],
|
|
68
74
|
}
|
|
75
|
+
versionDate: Date | undefined = undefined
|
|
69
76
|
|
|
70
77
|
/**
|
|
71
|
-
* Initializes the Socket
|
|
78
|
+
* Initializes the Socket.
|
|
72
79
|
*
|
|
73
80
|
* @param endPoint The string WebSocket endpoint, ie, "ws://example.com/socket", "wss://example.com", "/socket" (inherited host & protocol)
|
|
74
81
|
* @param options.transport The Websocket Transport, for example WebSocket.
|
|
@@ -115,14 +122,15 @@ export default class RealtimeClient {
|
|
|
115
122
|
}
|
|
116
123
|
|
|
117
124
|
/**
|
|
118
|
-
* Connects the socket.
|
|
125
|
+
* Connects the socket, unless already connected.
|
|
119
126
|
*/
|
|
120
|
-
connect() {
|
|
127
|
+
connect(): void {
|
|
121
128
|
if (this.conn) {
|
|
122
129
|
return
|
|
123
130
|
}
|
|
124
131
|
|
|
125
132
|
this.conn = new this.transport(this.endPointURL(), [], null, this.headers)
|
|
133
|
+
|
|
126
134
|
if (this.conn) {
|
|
127
135
|
// this.conn.timeout = this.longpollerTimeout // TYPE ERROR
|
|
128
136
|
this.conn.binaryType = 'arraybuffer'
|
|
@@ -130,6 +138,14 @@ export default class RealtimeClient {
|
|
|
130
138
|
this.conn.onerror = (error) => this._onConnError(error as ErrorEvent)
|
|
131
139
|
this.conn.onmessage = (event) => this.onConnMessage(event)
|
|
132
140
|
this.conn.onclose = (event) => this._onConnClose(event)
|
|
141
|
+
|
|
142
|
+
const versionDate = new Date(
|
|
143
|
+
new URL(this.conn.url).searchParams.get('vsndate') ?? ''
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
if (versionDate instanceof Date) {
|
|
147
|
+
this.versionDate = versionDate
|
|
148
|
+
}
|
|
133
149
|
}
|
|
134
150
|
}
|
|
135
151
|
|
|
@@ -165,7 +181,9 @@ export default class RealtimeClient {
|
|
|
165
181
|
}
|
|
166
182
|
|
|
167
183
|
/**
|
|
168
|
-
* Logs the message.
|
|
184
|
+
* Logs the message.
|
|
185
|
+
*
|
|
186
|
+
* For customized logging, `this.logger` can be overriden.
|
|
169
187
|
*/
|
|
170
188
|
log(kind: string, msg: string, data?: any) {
|
|
171
189
|
this.logger(kind, msg, data)
|
|
@@ -173,6 +191,7 @@ export default class RealtimeClient {
|
|
|
173
191
|
|
|
174
192
|
/**
|
|
175
193
|
* Registers a callback for connection state change event.
|
|
194
|
+
*
|
|
176
195
|
* @param callback A function to be called when the event occurs.
|
|
177
196
|
*
|
|
178
197
|
* @example
|
|
@@ -183,7 +202,8 @@ export default class RealtimeClient {
|
|
|
183
202
|
}
|
|
184
203
|
|
|
185
204
|
/**
|
|
186
|
-
* Registers a
|
|
205
|
+
* Registers a callback for connection state change events.
|
|
206
|
+
*
|
|
187
207
|
* @param callback A function to be called when the event occurs.
|
|
188
208
|
*
|
|
189
209
|
* @example
|
|
@@ -195,6 +215,7 @@ export default class RealtimeClient {
|
|
|
195
215
|
|
|
196
216
|
/**
|
|
197
217
|
* Registers a callback for connection state change events.
|
|
218
|
+
*
|
|
198
219
|
* @param callback A function to be called when the event occurs.
|
|
199
220
|
*
|
|
200
221
|
* @example
|
|
@@ -206,6 +227,7 @@ export default class RealtimeClient {
|
|
|
206
227
|
|
|
207
228
|
/**
|
|
208
229
|
* Calls a function any time a message is received.
|
|
230
|
+
*
|
|
209
231
|
* @param callback A function to be called when the event occurs.
|
|
210
232
|
*
|
|
211
233
|
* @example
|
|
@@ -218,24 +240,24 @@ export default class RealtimeClient {
|
|
|
218
240
|
/**
|
|
219
241
|
* Returns the current state of the socket.
|
|
220
242
|
*/
|
|
221
|
-
connectionState() {
|
|
243
|
+
connectionState(): CONNECTION_STATE {
|
|
222
244
|
switch (this.conn && this.conn.readyState) {
|
|
223
245
|
case SOCKET_STATES.connecting:
|
|
224
|
-
return
|
|
246
|
+
return CONNECTION_STATE.Connecting
|
|
225
247
|
case SOCKET_STATES.open:
|
|
226
|
-
return
|
|
248
|
+
return CONNECTION_STATE.Open
|
|
227
249
|
case SOCKET_STATES.closing:
|
|
228
|
-
return
|
|
250
|
+
return CONNECTION_STATE.Closing
|
|
229
251
|
default:
|
|
230
|
-
return
|
|
252
|
+
return CONNECTION_STATE.Closed
|
|
231
253
|
}
|
|
232
254
|
}
|
|
233
255
|
|
|
234
256
|
/**
|
|
235
257
|
* Retuns `true` is the connection is open.
|
|
236
258
|
*/
|
|
237
|
-
isConnected() {
|
|
238
|
-
return this.connectionState() ===
|
|
259
|
+
isConnected(): boolean {
|
|
260
|
+
return this.connectionState() === CONNECTION_STATE.Open
|
|
239
261
|
}
|
|
240
262
|
|
|
241
263
|
/**
|
|
@@ -252,13 +274,16 @@ export default class RealtimeClient {
|
|
|
252
274
|
|
|
253
275
|
channel(
|
|
254
276
|
topic: string,
|
|
255
|
-
chanParams:
|
|
256
|
-
) {
|
|
257
|
-
const {
|
|
277
|
+
chanParams: ChannelParams = {}
|
|
278
|
+
): RealtimeChannel | RealtimeSubscription {
|
|
279
|
+
const { selfBroadcast, ...params } = chanParams
|
|
280
|
+
if (selfBroadcast) {
|
|
281
|
+
params.self_broadcast = selfBroadcast
|
|
282
|
+
}
|
|
258
283
|
|
|
259
|
-
const chan =
|
|
260
|
-
? new RealtimeChannel(topic,
|
|
261
|
-
: new RealtimeSubscription(topic,
|
|
284
|
+
const chan = this.versionDate
|
|
285
|
+
? new RealtimeChannel(topic, params, this)
|
|
286
|
+
: new RealtimeSubscription(topic, params, this)
|
|
262
287
|
|
|
263
288
|
if (chan instanceof RealtimeChannel) {
|
|
264
289
|
chan.presence.onJoin((key, currentPresences, newPresences) => {
|
|
@@ -288,8 +313,13 @@ export default class RealtimeClient {
|
|
|
288
313
|
return chan
|
|
289
314
|
}
|
|
290
315
|
|
|
291
|
-
|
|
292
|
-
|
|
316
|
+
/**
|
|
317
|
+
* Push out a message if the socket is connected.
|
|
318
|
+
*
|
|
319
|
+
* If the socket is not connected, the message gets enqueued within a local buffer, and sent out when a connection is next established.
|
|
320
|
+
*/
|
|
321
|
+
push(data: Message): void {
|
|
322
|
+
const { topic, event, payload, ref } = data
|
|
293
323
|
let callback = () => {
|
|
294
324
|
this.encode(data, (result: any) => {
|
|
295
325
|
this.conn?.send(result)
|
|
@@ -303,7 +333,7 @@ export default class RealtimeClient {
|
|
|
303
333
|
}
|
|
304
334
|
}
|
|
305
335
|
|
|
306
|
-
onConnMessage(rawMessage: any) {
|
|
336
|
+
onConnMessage(rawMessage: { data: any }) {
|
|
307
337
|
this.decode(rawMessage.data, (msg: Message) => {
|
|
308
338
|
let { topic, event, payload, ref } = msg
|
|
309
339
|
|
|
@@ -335,7 +365,7 @@ export default class RealtimeClient {
|
|
|
335
365
|
/**
|
|
336
366
|
* Returns the URL of the websocket.
|
|
337
367
|
*/
|
|
338
|
-
endPointURL() {
|
|
368
|
+
endPointURL(): string {
|
|
339
369
|
return this._appendParams(
|
|
340
370
|
this.endPoint,
|
|
341
371
|
Object.assign({}, this.params, { vsn: VSN })
|
|
@@ -345,7 +375,7 @@ export default class RealtimeClient {
|
|
|
345
375
|
/**
|
|
346
376
|
* Return the next message ref, accounting for overflows
|
|
347
377
|
*/
|
|
348
|
-
makeRef() {
|
|
378
|
+
makeRef(): string {
|
|
349
379
|
let newRef = this.ref + 1
|
|
350
380
|
if (newRef === this.ref) {
|
|
351
381
|
this.ref = 0
|
|
@@ -364,19 +394,18 @@ export default class RealtimeClient {
|
|
|
364
394
|
setAuth(token: string | null) {
|
|
365
395
|
this.accessToken = token
|
|
366
396
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
token && channel.updateJoinPayload({ user_token: token })
|
|
397
|
+
this.channels.forEach((channel) => {
|
|
398
|
+
token && channel.updateJoinPayload({ user_token: token })
|
|
370
399
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
} catch (error) {
|
|
376
|
-
console.log('setAuth error', error)
|
|
377
|
-
}
|
|
400
|
+
if (channel.joinedOnce && channel.isJoined()) {
|
|
401
|
+
channel.push(CHANNEL_EVENTS.access_token, { access_token: token })
|
|
402
|
+
}
|
|
403
|
+
})
|
|
378
404
|
}
|
|
379
405
|
|
|
406
|
+
/**
|
|
407
|
+
* Unsubscribe from channels with the specified topic.
|
|
408
|
+
*/
|
|
380
409
|
leaveOpenTopic(topic: string): void {
|
|
381
410
|
let dupChannel = this.channels.find(
|
|
382
411
|
(c) => c.topic === topic && (c.isJoined() || c.isJoining())
|
|
@@ -419,7 +448,10 @@ export default class RealtimeClient {
|
|
|
419
448
|
)
|
|
420
449
|
}
|
|
421
450
|
|
|
422
|
-
private _appendParams(
|
|
451
|
+
private _appendParams(
|
|
452
|
+
url: string,
|
|
453
|
+
params: { [key: string]: string }
|
|
454
|
+
): string {
|
|
423
455
|
if (Object.keys(params).length === 0) {
|
|
424
456
|
return url
|
|
425
457
|
}
|
package/src/RealtimePresence.ts
CHANGED
|
@@ -55,7 +55,8 @@ export default class RealtimePresence {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
* Initializes the Presence
|
|
58
|
+
* Initializes the Presence.
|
|
59
|
+
*
|
|
59
60
|
* @param channel - The RealtimeSubscription
|
|
60
61
|
* @param opts - The options,
|
|
61
62
|
* for example `{events: {state: 'state', diff: 'diff'}}`
|
|
@@ -111,9 +112,11 @@ export default class RealtimePresence {
|
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
/**
|
|
114
|
-
* Used to sync the list of presences on the server
|
|
115
|
-
*
|
|
116
|
-
*
|
|
115
|
+
* Used to sync the list of presences on the server with the
|
|
116
|
+
* client's state.
|
|
117
|
+
*
|
|
118
|
+
* An optional `onJoin` and `onLeave` callback can be provided to
|
|
119
|
+
* react to changes in the client's local presences across
|
|
117
120
|
* disconnects and reconnects with the server.
|
|
118
121
|
*/
|
|
119
122
|
static syncState(
|
|
@@ -164,11 +167,12 @@ export default class RealtimePresence {
|
|
|
164
167
|
}
|
|
165
168
|
|
|
166
169
|
/**
|
|
170
|
+
* Used to sync a diff of presence join and leave events from the
|
|
171
|
+
* server, as they happen.
|
|
167
172
|
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
* joining or leaving from a device.
|
|
173
|
+
* Like `syncState`, `syncDiff` accepts optional `onJoin` and
|
|
174
|
+
* `onLeave` callbacks to react to a user joining or leaving from a
|
|
175
|
+
* device.
|
|
172
176
|
*/
|
|
173
177
|
static syncDiff(
|
|
174
178
|
state: PresenceState,
|
package/src/lib/constants.ts
CHANGED
package/src/lib/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.
|
|
1
|
+
export const version = '1.7.0'
|