@crowdedkingdomstudios/crowdyjs 4.0.0 → 5.0.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/MIGRATION.md +30 -0
- package/dist/crowdy-client.d.ts +8 -0
- package/dist/crowdy-client.d.ts.map +1 -1
- package/dist/crowdy-client.js +6 -0
- package/dist/domains/apps.d.ts +13 -2
- package/dist/domains/apps.d.ts.map +1 -1
- package/dist/domains/apps.js +5 -2
- package/dist/domains/channels.d.ts +34 -0
- package/dist/domains/channels.d.ts.map +1 -0
- package/dist/domains/channels.js +94 -0
- package/dist/domains/gameModel.d.ts +40 -0
- package/dist/domains/gameModel.d.ts.map +1 -0
- package/dist/domains/gameModel.js +114 -0
- package/dist/domains/platform.d.ts +33 -0
- package/dist/domains/platform.d.ts.map +1 -0
- package/dist/domains/platform.js +39 -0
- package/dist/domains/udp.d.ts +18 -6
- package/dist/domains/udp.d.ts.map +1 -1
- package/dist/domains/udp.js +22 -7
- package/dist/generated/graphql.d.ts +1810 -31
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +68 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/realtime.d.ts +5 -1
- package/dist/realtime.d.ts.map +1 -1
- package/dist/realtime.js +29 -2
- package/dist/world.js +1 -1
- package/package.json +2 -3
package/dist/domains/udp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConnectUdpProxyDocument, DisconnectUdpProxyDocument, UdpProxyConnectionStatusDocument, SendActorUpdateDocument, SendVoxelUpdateDocument, SendAudioPacketDocument, SendTextPacketDocument, SendClientEventDocument, SendSingleActorMessageDocument, } from '../generated/graphql.js';
|
|
1
|
+
import { ConnectUdpProxyDocument, DisconnectUdpProxyDocument, UdpProxyConnectionStatusDocument, SendActorUpdateDocument, SendVoxelUpdateDocument, SendAudioPacketDocument, SendTextPacketDocument, SendClientEventDocument, SendSingleActorMessageDocument, SendChannelMessageDocument, } from '../generated/graphql.js';
|
|
2
2
|
import { SequenceAllocator } from '../utils.js';
|
|
3
3
|
/**
|
|
4
4
|
* UDP proxy access for browser-style clients that can't open raw UDP
|
|
@@ -89,13 +89,28 @@ export class UdpAPI {
|
|
|
89
89
|
return data.sendSingleActorMessage;
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
92
|
+
* Publish a message to a channel. Delivered to every active member of the
|
|
93
|
+
* channel (regardless of location) as a `ChannelMessageNotification` on their
|
|
94
|
+
* `udpNotifications` subscription. Requires the channel `send_messages`
|
|
95
|
+
* permission; the server drops the message otherwise. Fire-and-forget: the
|
|
96
|
+
* sender receives no echo.
|
|
96
97
|
*/
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
async sendChannelMessage(input) {
|
|
99
|
+
const data = await this.gql.request(SendChannelMessageDocument, { input });
|
|
100
|
+
return data.sendChannelMessage;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Subscribe to udpNotifications for a single app. Pass any combination of
|
|
104
|
+
* typename handlers; the returned function detaches all of them. The first
|
|
105
|
+
* subscriber opens the shared WebSocket; the last one to leave closes it.
|
|
106
|
+
*
|
|
107
|
+
* `appId` is required and scopes the subscription to one app: the game-api
|
|
108
|
+
* only delivers that app's spatial notifications and rejects app-agnostic
|
|
109
|
+
* subscriptions (a single game token reused across apps would otherwise
|
|
110
|
+
* cross-deliver). Use a separate client per app (sharing the token store).
|
|
111
|
+
*/
|
|
112
|
+
subscribe(handlers, appId) {
|
|
113
|
+
return this.subs.subscribe(handlers, appId);
|
|
99
114
|
}
|
|
100
115
|
withSequence(input) {
|
|
101
116
|
return {
|