@pluv/client 0.37.7 → 0.38.1
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/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +19 -0
- package/dist/index.js +17 -17
- package/dist/index.mjs +17 -17
- package/package.json +5 -5
- package/src/MockedRoom.ts +1 -1
- package/src/PluvRoom.ts +20 -20
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/client@0.
|
|
2
|
+
> @pluv/client@0.38.1 build /home/runner/work/pluv/pluv/packages/client
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --dts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
[34mCLI[39m Target: es6
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
|
-
[32mCJS[39m [1mdist/index.js [22m[32m48.
|
|
12
|
-
[32mCJS[39m ⚡️ Build success in
|
|
13
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m47.
|
|
14
|
-
[32mESM[39m ⚡️ Build success in
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m48.91 KB[39m
|
|
12
|
+
[32mCJS[39m ⚡️ Build success in 115ms
|
|
13
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m47.59 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 129ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 3357ms
|
|
17
17
|
[32mDTS[39m [1mdist/index.d.mts [22m[32m23.13 KB[39m
|
|
18
18
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m23.13 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @pluv/client
|
|
2
2
|
|
|
3
|
+
## 0.38.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @pluv/crdt@0.38.1
|
|
8
|
+
- @pluv/types@0.38.1
|
|
9
|
+
|
|
10
|
+
## 0.38.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- f4ceca3: Updated internal event names to follow a new naming convention.
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [f4ceca3]
|
|
19
|
+
- @pluv/types@0.38.0
|
|
20
|
+
- @pluv/crdt@0.38.0
|
|
21
|
+
|
|
3
22
|
## 0.37.7
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -432,8 +432,8 @@ var ADD_TO_STORAGE_STATE_DEBOUNCE_MS = 1e3;
|
|
|
432
432
|
var HEARTBEAT_INTERVAL_MS = 1e4;
|
|
433
433
|
var PONG_TIMEOUT_MS = 2e3;
|
|
434
434
|
var RECONNECT_TIMEOUT_MS = 3e4;
|
|
435
|
-
var ORIGIN_INITIALIZED = "$
|
|
436
|
-
var ORIGIN_STORAGE_UPDATED = "$
|
|
435
|
+
var ORIGIN_INITIALIZED = "$initialized";
|
|
436
|
+
var ORIGIN_STORAGE_UPDATED = "$storageUpdated";
|
|
437
437
|
var DEFAULT_PLUV_CLIENT_ADDON = (input) => ({
|
|
438
438
|
storage: new StorageStore(input.room.id)
|
|
439
439
|
});
|
|
@@ -590,7 +590,7 @@ var PluvRoom = class extends AbstractRoom {
|
|
|
590
590
|
this._stateNotifier.subjects["my-presence"].next(myPresence);
|
|
591
591
|
!!myself && this._stateNotifier.subjects["myself"].next(myself);
|
|
592
592
|
this.broadcast(
|
|
593
|
-
"$
|
|
593
|
+
"$updatePresence",
|
|
594
594
|
{ presence: newPresence }
|
|
595
595
|
);
|
|
596
596
|
};
|
|
@@ -907,7 +907,7 @@ var PluvRoom = class extends AbstractRoom {
|
|
|
907
907
|
this._stateNotifier.subjects["myself"].next(myself);
|
|
908
908
|
const update = this._state.connection.count > 1 ? (_b = this._crdtManager.doc.getEncodedState()) != null ? _b : null : null;
|
|
909
909
|
this._sendMessage({
|
|
910
|
-
type: "$
|
|
910
|
+
type: "$initializeSession",
|
|
911
911
|
data: { presence, update }
|
|
912
912
|
});
|
|
913
913
|
}
|
|
@@ -932,7 +932,7 @@ var PluvRoom = class extends AbstractRoom {
|
|
|
932
932
|
this._emitSharedTypes();
|
|
933
933
|
const update = this._crdtManager.doc.getEncodedState();
|
|
934
934
|
this._sendMessage({
|
|
935
|
-
type: "$
|
|
935
|
+
type: "$updateStorage",
|
|
936
936
|
data: { origin: ORIGIN_INITIALIZED, update }
|
|
937
937
|
});
|
|
938
938
|
});
|
|
@@ -967,7 +967,7 @@ var PluvRoom = class extends AbstractRoom {
|
|
|
967
967
|
const data = message.data;
|
|
968
968
|
const myself = this._usersManager.myself;
|
|
969
969
|
if (myself.connectionId === connectionId) {
|
|
970
|
-
this._sendMessage({ type: "$
|
|
970
|
+
this._sendMessage({ type: "$getOthers", data: {} });
|
|
971
971
|
}
|
|
972
972
|
this._usersManager.setUser(connectionId, data.user, data.presence);
|
|
973
973
|
const other = this._usersManager.getOther(connectionId);
|
|
@@ -978,7 +978,7 @@ var PluvRoom = class extends AbstractRoom {
|
|
|
978
978
|
_heartbeat() {
|
|
979
979
|
this._clearTimeout(this._timeouts.pong);
|
|
980
980
|
this._timeouts.pong = setTimeout(this._reconnect.bind(this), PONG_TIMEOUT_MS);
|
|
981
|
-
this._sendMessage('{"type":"$
|
|
981
|
+
this._sendMessage('{"type":"$ping","data":{}}');
|
|
982
982
|
}
|
|
983
983
|
_logDebug(...data) {
|
|
984
984
|
var _a;
|
|
@@ -1001,7 +1001,7 @@ var PluvRoom = class extends AbstractRoom {
|
|
|
1001
1001
|
if (!this._state.connection.id) return;
|
|
1002
1002
|
if (this._state.webSocket.readyState !== WebSocket.OPEN) return;
|
|
1003
1003
|
this._sendMessage({
|
|
1004
|
-
type: "$
|
|
1004
|
+
type: "$updateStorage",
|
|
1005
1005
|
data: { origin, update: event.update }
|
|
1006
1006
|
});
|
|
1007
1007
|
});
|
|
@@ -1054,35 +1054,35 @@ var PluvRoom = class extends AbstractRoom {
|
|
|
1054
1054
|
}
|
|
1055
1055
|
this._eventNotifier.subject(message.type).next(message);
|
|
1056
1056
|
switch (message.type) {
|
|
1057
|
-
case "$
|
|
1057
|
+
case "$exit": {
|
|
1058
1058
|
this._handleExit(message);
|
|
1059
1059
|
return;
|
|
1060
1060
|
}
|
|
1061
|
-
case "$
|
|
1061
|
+
case "$othersReceived": {
|
|
1062
1062
|
this._handleReceiveOthers(message);
|
|
1063
1063
|
return;
|
|
1064
1064
|
}
|
|
1065
|
-
case "$
|
|
1065
|
+
case "$pong": {
|
|
1066
1066
|
this._clearTimeout(this._timeouts.pong);
|
|
1067
1067
|
return;
|
|
1068
1068
|
}
|
|
1069
|
-
case "$
|
|
1069
|
+
case "$presenceUpdated": {
|
|
1070
1070
|
this._handlePresenceUpdatedMessage(message);
|
|
1071
1071
|
return;
|
|
1072
1072
|
}
|
|
1073
|
-
case "$
|
|
1073
|
+
case "$registered": {
|
|
1074
1074
|
this._handleRegisteredMessage(message);
|
|
1075
1075
|
return;
|
|
1076
1076
|
}
|
|
1077
|
-
case "$
|
|
1077
|
+
case "$storageReceived": {
|
|
1078
1078
|
this._handleStorageReceivedMessage(message);
|
|
1079
1079
|
return;
|
|
1080
1080
|
}
|
|
1081
|
-
case "$
|
|
1081
|
+
case "$storageUpdated": {
|
|
1082
1082
|
this._handleStorageUpdatedMessage(message);
|
|
1083
1083
|
return;
|
|
1084
1084
|
}
|
|
1085
|
-
case "$
|
|
1085
|
+
case "$userJoined": {
|
|
1086
1086
|
this._handleUserJoinedMessage(message);
|
|
1087
1087
|
return;
|
|
1088
1088
|
}
|
|
@@ -1433,7 +1433,7 @@ var MockedRoom = class extends AbstractRoom {
|
|
|
1433
1433
|
var _a2;
|
|
1434
1434
|
const origin = (_a2 = event.origin) != null ? _a2 : null;
|
|
1435
1435
|
if (!this._crdtManager) return;
|
|
1436
|
-
if (origin === "$
|
|
1436
|
+
if (origin === "$storageUpdated") return;
|
|
1437
1437
|
const sharedTypes = this._crdtManager.doc.get();
|
|
1438
1438
|
const storageRoot = Object.keys(sharedTypes).reduce(
|
|
1439
1439
|
(acc, prop) => {
|
package/dist/index.mjs
CHANGED
|
@@ -401,8 +401,8 @@ var ADD_TO_STORAGE_STATE_DEBOUNCE_MS = 1e3;
|
|
|
401
401
|
var HEARTBEAT_INTERVAL_MS = 1e4;
|
|
402
402
|
var PONG_TIMEOUT_MS = 2e3;
|
|
403
403
|
var RECONNECT_TIMEOUT_MS = 3e4;
|
|
404
|
-
var ORIGIN_INITIALIZED = "$
|
|
405
|
-
var ORIGIN_STORAGE_UPDATED = "$
|
|
404
|
+
var ORIGIN_INITIALIZED = "$initialized";
|
|
405
|
+
var ORIGIN_STORAGE_UPDATED = "$storageUpdated";
|
|
406
406
|
var DEFAULT_PLUV_CLIENT_ADDON = (input) => ({
|
|
407
407
|
storage: new StorageStore(input.room.id)
|
|
408
408
|
});
|
|
@@ -559,7 +559,7 @@ var PluvRoom = class extends AbstractRoom {
|
|
|
559
559
|
this._stateNotifier.subjects["my-presence"].next(myPresence);
|
|
560
560
|
!!myself && this._stateNotifier.subjects["myself"].next(myself);
|
|
561
561
|
this.broadcast(
|
|
562
|
-
"$
|
|
562
|
+
"$updatePresence",
|
|
563
563
|
{ presence: newPresence }
|
|
564
564
|
);
|
|
565
565
|
};
|
|
@@ -876,7 +876,7 @@ var PluvRoom = class extends AbstractRoom {
|
|
|
876
876
|
this._stateNotifier.subjects["myself"].next(myself);
|
|
877
877
|
const update = this._state.connection.count > 1 ? (_b = this._crdtManager.doc.getEncodedState()) != null ? _b : null : null;
|
|
878
878
|
this._sendMessage({
|
|
879
|
-
type: "$
|
|
879
|
+
type: "$initializeSession",
|
|
880
880
|
data: { presence, update }
|
|
881
881
|
});
|
|
882
882
|
}
|
|
@@ -901,7 +901,7 @@ var PluvRoom = class extends AbstractRoom {
|
|
|
901
901
|
this._emitSharedTypes();
|
|
902
902
|
const update = this._crdtManager.doc.getEncodedState();
|
|
903
903
|
this._sendMessage({
|
|
904
|
-
type: "$
|
|
904
|
+
type: "$updateStorage",
|
|
905
905
|
data: { origin: ORIGIN_INITIALIZED, update }
|
|
906
906
|
});
|
|
907
907
|
});
|
|
@@ -936,7 +936,7 @@ var PluvRoom = class extends AbstractRoom {
|
|
|
936
936
|
const data = message.data;
|
|
937
937
|
const myself = this._usersManager.myself;
|
|
938
938
|
if (myself.connectionId === connectionId) {
|
|
939
|
-
this._sendMessage({ type: "$
|
|
939
|
+
this._sendMessage({ type: "$getOthers", data: {} });
|
|
940
940
|
}
|
|
941
941
|
this._usersManager.setUser(connectionId, data.user, data.presence);
|
|
942
942
|
const other = this._usersManager.getOther(connectionId);
|
|
@@ -947,7 +947,7 @@ var PluvRoom = class extends AbstractRoom {
|
|
|
947
947
|
_heartbeat() {
|
|
948
948
|
this._clearTimeout(this._timeouts.pong);
|
|
949
949
|
this._timeouts.pong = setTimeout(this._reconnect.bind(this), PONG_TIMEOUT_MS);
|
|
950
|
-
this._sendMessage('{"type":"$
|
|
950
|
+
this._sendMessage('{"type":"$ping","data":{}}');
|
|
951
951
|
}
|
|
952
952
|
_logDebug(...data) {
|
|
953
953
|
var _a;
|
|
@@ -970,7 +970,7 @@ var PluvRoom = class extends AbstractRoom {
|
|
|
970
970
|
if (!this._state.connection.id) return;
|
|
971
971
|
if (this._state.webSocket.readyState !== WebSocket.OPEN) return;
|
|
972
972
|
this._sendMessage({
|
|
973
|
-
type: "$
|
|
973
|
+
type: "$updateStorage",
|
|
974
974
|
data: { origin, update: event.update }
|
|
975
975
|
});
|
|
976
976
|
});
|
|
@@ -1023,35 +1023,35 @@ var PluvRoom = class extends AbstractRoom {
|
|
|
1023
1023
|
}
|
|
1024
1024
|
this._eventNotifier.subject(message.type).next(message);
|
|
1025
1025
|
switch (message.type) {
|
|
1026
|
-
case "$
|
|
1026
|
+
case "$exit": {
|
|
1027
1027
|
this._handleExit(message);
|
|
1028
1028
|
return;
|
|
1029
1029
|
}
|
|
1030
|
-
case "$
|
|
1030
|
+
case "$othersReceived": {
|
|
1031
1031
|
this._handleReceiveOthers(message);
|
|
1032
1032
|
return;
|
|
1033
1033
|
}
|
|
1034
|
-
case "$
|
|
1034
|
+
case "$pong": {
|
|
1035
1035
|
this._clearTimeout(this._timeouts.pong);
|
|
1036
1036
|
return;
|
|
1037
1037
|
}
|
|
1038
|
-
case "$
|
|
1038
|
+
case "$presenceUpdated": {
|
|
1039
1039
|
this._handlePresenceUpdatedMessage(message);
|
|
1040
1040
|
return;
|
|
1041
1041
|
}
|
|
1042
|
-
case "$
|
|
1042
|
+
case "$registered": {
|
|
1043
1043
|
this._handleRegisteredMessage(message);
|
|
1044
1044
|
return;
|
|
1045
1045
|
}
|
|
1046
|
-
case "$
|
|
1046
|
+
case "$storageReceived": {
|
|
1047
1047
|
this._handleStorageReceivedMessage(message);
|
|
1048
1048
|
return;
|
|
1049
1049
|
}
|
|
1050
|
-
case "$
|
|
1050
|
+
case "$storageUpdated": {
|
|
1051
1051
|
this._handleStorageUpdatedMessage(message);
|
|
1052
1052
|
return;
|
|
1053
1053
|
}
|
|
1054
|
-
case "$
|
|
1054
|
+
case "$userJoined": {
|
|
1055
1055
|
this._handleUserJoinedMessage(message);
|
|
1056
1056
|
return;
|
|
1057
1057
|
}
|
|
@@ -1402,7 +1402,7 @@ var MockedRoom = class extends AbstractRoom {
|
|
|
1402
1402
|
var _a2;
|
|
1403
1403
|
const origin = (_a2 = event.origin) != null ? _a2 : null;
|
|
1404
1404
|
if (!this._crdtManager) return;
|
|
1405
|
-
if (origin === "$
|
|
1405
|
+
if (origin === "$storageUpdated") return;
|
|
1406
1406
|
const sharedTypes = this._crdtManager.doc.get();
|
|
1407
1407
|
const storageRoot = Object.keys(sharedTypes).reduce(
|
|
1408
1408
|
(acc, prop) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.1",
|
|
4
4
|
"description": "@pluv/io frontend client",
|
|
5
5
|
"author": "leedavidcs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,15 +18,15 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"wonka": "^6.3.5",
|
|
21
|
-
"@pluv/crdt": "^0.
|
|
22
|
-
"@pluv/types": "^0.
|
|
21
|
+
"@pluv/crdt": "^0.38.1",
|
|
22
|
+
"@pluv/types": "^0.38.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"eslint": "^8.57.1",
|
|
26
26
|
"tsup": "^8.4.0",
|
|
27
27
|
"typescript": "^5.8.2",
|
|
28
|
-
"@pluv/tsconfig": "^0.
|
|
29
|
-
"eslint-config-pluv": "^0.
|
|
28
|
+
"@pluv/tsconfig": "^0.38.1",
|
|
29
|
+
"eslint-config-pluv": "^0.38.1"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|
package/src/MockedRoom.ts
CHANGED
|
@@ -301,7 +301,7 @@ export class MockedRoom<
|
|
|
301
301
|
const origin = event.origin ?? null;
|
|
302
302
|
|
|
303
303
|
if (!this._crdtManager) return;
|
|
304
|
-
if (origin === "$
|
|
304
|
+
if (origin === "$storageUpdated") return;
|
|
305
305
|
|
|
306
306
|
const sharedTypes = this._crdtManager.doc.get();
|
|
307
307
|
|
package/src/PluvRoom.ts
CHANGED
|
@@ -47,8 +47,8 @@ const ADD_TO_STORAGE_STATE_DEBOUNCE_MS = 1_000;
|
|
|
47
47
|
const HEARTBEAT_INTERVAL_MS = 10_000;
|
|
48
48
|
const PONG_TIMEOUT_MS = 2_000;
|
|
49
49
|
const RECONNECT_TIMEOUT_MS = 30_000;
|
|
50
|
-
const ORIGIN_INITIALIZED = "$
|
|
51
|
-
const ORIGIN_STORAGE_UPDATED = "$
|
|
50
|
+
const ORIGIN_INITIALIZED = "$initialized";
|
|
51
|
+
const ORIGIN_STORAGE_UPDATED = "$storageUpdated";
|
|
52
52
|
|
|
53
53
|
export const DEFAULT_PLUV_CLIENT_ADDON = <
|
|
54
54
|
TIO extends IOLike = IOLike,
|
|
@@ -534,7 +534,7 @@ export class PluvRoom<
|
|
|
534
534
|
!!myself && this._stateNotifier.subjects["myself"].next(myself);
|
|
535
535
|
|
|
536
536
|
this.broadcast(
|
|
537
|
-
"$
|
|
537
|
+
"$updatePresence" as keyof InferIOInput<MergeEvents<TEvents, TIO>>,
|
|
538
538
|
{ presence: newPresence } as any,
|
|
539
539
|
);
|
|
540
540
|
};
|
|
@@ -778,7 +778,7 @@ export class PluvRoom<
|
|
|
778
778
|
// Should not reach here
|
|
779
779
|
if (!this._state.webSocket) throw new Error("Could not find WebSocket");
|
|
780
780
|
|
|
781
|
-
const data = message.data as BaseIOEventRecord<InferIOAuthorize<TIO>>["$
|
|
781
|
+
const data = message.data as BaseIOEventRecord<InferIOAuthorize<TIO>>["$presenceUpdated"];
|
|
782
782
|
|
|
783
783
|
this._usersManager.patchPresence(connectionId, data.presence as TPresence);
|
|
784
784
|
|
|
@@ -804,7 +804,7 @@ export class PluvRoom<
|
|
|
804
804
|
// Should not reach here
|
|
805
805
|
if (!this._state.webSocket) throw new Error("Could not find WebSocket");
|
|
806
806
|
|
|
807
|
-
const data = message.data as BaseIOEventRecord<InferIOAuthorize<TIO>>["$
|
|
807
|
+
const data = message.data as BaseIOEventRecord<InferIOAuthorize<TIO>>["$othersReceived"];
|
|
808
808
|
|
|
809
809
|
Object.keys(data.others).forEach((connectionId) => {
|
|
810
810
|
const { presence, user } = data.others[connectionId];
|
|
@@ -849,7 +849,7 @@ export class PluvRoom<
|
|
|
849
849
|
const update = this._state.connection.count > 1 ? (this._crdtManager.doc.getEncodedState() ?? null) : null;
|
|
850
850
|
|
|
851
851
|
this._sendMessage({
|
|
852
|
-
type: "$
|
|
852
|
+
type: "$initializeSession",
|
|
853
853
|
data: { presence, update },
|
|
854
854
|
});
|
|
855
855
|
}
|
|
@@ -861,7 +861,7 @@ export class PluvRoom<
|
|
|
861
861
|
// Should not reach here
|
|
862
862
|
if (!this._state.webSocket) throw new Error("Could not find WebSocket");
|
|
863
863
|
|
|
864
|
-
const data = message.data as BaseIOEventRecord<InferIOAuthorize<TIO>>["$
|
|
864
|
+
const data = message.data as BaseIOEventRecord<InferIOAuthorize<TIO>>["$storageReceived"];
|
|
865
865
|
|
|
866
866
|
this._crdtManager.initialize({
|
|
867
867
|
onInitialized: async (update) => {
|
|
@@ -884,7 +884,7 @@ export class PluvRoom<
|
|
|
884
884
|
const update = this._crdtManager.doc.getEncodedState();
|
|
885
885
|
|
|
886
886
|
this._sendMessage({
|
|
887
|
-
type: "$
|
|
887
|
+
type: "$updateStorage",
|
|
888
888
|
data: { origin: ORIGIN_INITIALIZED, update },
|
|
889
889
|
});
|
|
890
890
|
}
|
|
@@ -933,12 +933,12 @@ export class PluvRoom<
|
|
|
933
933
|
if (!this._state.webSocket) throw new Error("Could not find WebSocket");
|
|
934
934
|
if (!this._usersManager.myself) return;
|
|
935
935
|
|
|
936
|
-
const data = message.data as BaseIOEventRecord<InferIOAuthorize<TIO>>["$
|
|
936
|
+
const data = message.data as BaseIOEventRecord<InferIOAuthorize<TIO>>["$userJoined"];
|
|
937
937
|
|
|
938
938
|
const myself = this._usersManager.myself;
|
|
939
939
|
|
|
940
940
|
if (myself.connectionId === connectionId) {
|
|
941
|
-
this._sendMessage({ type: "$
|
|
941
|
+
this._sendMessage({ type: "$getOthers", data: {} });
|
|
942
942
|
}
|
|
943
943
|
|
|
944
944
|
this._usersManager.setUser(connectionId, data.user, data.presence as TPresence);
|
|
@@ -960,7 +960,7 @@ export class PluvRoom<
|
|
|
960
960
|
* consistent way.
|
|
961
961
|
* @date July 8, 2024
|
|
962
962
|
*/
|
|
963
|
-
this._sendMessage('{"type":"$
|
|
963
|
+
this._sendMessage('{"type":"$ping","data":{}}');
|
|
964
964
|
}
|
|
965
965
|
|
|
966
966
|
private _logDebug(...data: any[]): void {
|
|
@@ -990,7 +990,7 @@ export class PluvRoom<
|
|
|
990
990
|
if (this._state.webSocket.readyState !== WebSocket.OPEN) return;
|
|
991
991
|
|
|
992
992
|
this._sendMessage({
|
|
993
|
-
type: "$
|
|
993
|
+
type: "$updateStorage",
|
|
994
994
|
data: { origin, update: event.update },
|
|
995
995
|
});
|
|
996
996
|
});
|
|
@@ -1058,35 +1058,35 @@ export class PluvRoom<
|
|
|
1058
1058
|
this._eventNotifier.subject(message.type as keyof InferIOOutput<TIO>).next(message as any);
|
|
1059
1059
|
|
|
1060
1060
|
switch (message.type) {
|
|
1061
|
-
case "$
|
|
1061
|
+
case "$exit": {
|
|
1062
1062
|
this._handleExit(message);
|
|
1063
1063
|
return;
|
|
1064
1064
|
}
|
|
1065
|
-
case "$
|
|
1065
|
+
case "$othersReceived": {
|
|
1066
1066
|
this._handleReceiveOthers(message);
|
|
1067
1067
|
return;
|
|
1068
1068
|
}
|
|
1069
|
-
case "$
|
|
1069
|
+
case "$pong": {
|
|
1070
1070
|
this._clearTimeout(this._timeouts.pong);
|
|
1071
1071
|
return;
|
|
1072
1072
|
}
|
|
1073
|
-
case "$
|
|
1073
|
+
case "$presenceUpdated": {
|
|
1074
1074
|
this._handlePresenceUpdatedMessage(message);
|
|
1075
1075
|
return;
|
|
1076
1076
|
}
|
|
1077
|
-
case "$
|
|
1077
|
+
case "$registered": {
|
|
1078
1078
|
this._handleRegisteredMessage(message);
|
|
1079
1079
|
return;
|
|
1080
1080
|
}
|
|
1081
|
-
case "$
|
|
1081
|
+
case "$storageReceived": {
|
|
1082
1082
|
this._handleStorageReceivedMessage(message);
|
|
1083
1083
|
return;
|
|
1084
1084
|
}
|
|
1085
|
-
case "$
|
|
1085
|
+
case "$storageUpdated": {
|
|
1086
1086
|
this._handleStorageUpdatedMessage(message);
|
|
1087
1087
|
return;
|
|
1088
1088
|
}
|
|
1089
|
-
case "$
|
|
1089
|
+
case "$userJoined": {
|
|
1090
1090
|
this._handleUserJoinedMessage(message);
|
|
1091
1091
|
return;
|
|
1092
1092
|
}
|