@genex-ai/multiplayer 0.10.2 → 0.11.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/index.d.ts CHANGED
@@ -9,6 +9,11 @@ type ConnectOptions = {
9
9
  /** Regional relay urls (pass `getColyseusUrls()`) — the SDK pings each and connects to the
10
10
  * lowest-latency one; a single entry just connects. */
11
11
  urls: string[];
12
+ /** Cross-region invite override: connect to THIS exact relay url, skipping latency selection. Two
13
+ * players are only in the same room if they share one region's relay, so an invitee must follow the
14
+ * inviter's region (carried in the invite) instead of picking its own nearest. Omit for normal
15
+ * nearest-region play. */
16
+ url?: string;
12
17
  /** Game id — everyone who passes the same id shares a room; different ids are
13
18
  * fully isolated. Use your project slug (or any stable per-game string). */
14
19
  room: string;
@@ -277,6 +282,9 @@ type Matchmaking<TState extends Record<string, unknown>> = {
277
282
  type MatchmakeOptions = {
278
283
  /** Regional relay urls (pass `getColyseusUrls()`) — pings each, connects to the lowest-latency one. */
279
284
  urls: string[];
285
+ /** Cross-region override: matchmake on THIS exact relay url, skipping latency selection — an invitee
286
+ * follows the inviter's region so both land on the same relay. Omit for normal nearest-region play. */
287
+ url?: string;
280
288
  /** Game id (your project slug/id) — isolates this game's matchmaking. */
281
289
  room: string;
282
290
  name?: string;
package/dist/index.js CHANGED
@@ -28,6 +28,7 @@ var STATE_SNAP_MSG = "__state:snap";
28
28
  var OBJECT_SNAP_MSG = "__object:snap";
29
29
  var MP_PROTOCOL = 2;
30
30
  async function relayClient(opts) {
31
+ if (opts.url) return new Client(opts.url);
31
32
  if (opts.urls.length > 1) return Client.selectByLatency(opts.urls);
32
33
  const url = opts.urls[0];
33
34
  if (!url) throw new Error("genex multiplayer: `urls` must contain at least one relay URL");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genex-ai/multiplayer",
3
- "version": "0.10.2",
3
+ "version": "0.11.0",
4
4
  "description": "The multiplayer client wrapper + shared room schema for genex.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",