twinwire 0.0.0-stage → 1.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/CHANGELOG.md +29 -0
- package/LICENSE +21 -0
- package/README.md +128 -2
- package/dist/browser/twinwire.js +2075 -0
- package/dist/browser/twinwire.js.map +7 -0
- package/dist/browser/twinwire.min.js +1 -0
- package/dist/browser/twinwire.mjs +2052 -0
- package/dist/browser/twinwire.mjs.map +7 -0
- package/dist/browser.d.ts +5 -0
- package/dist/browser.js +6 -0
- package/dist/browser.js.map +1 -0
- package/dist/client/client.d.ts +128 -0
- package/dist/client/client.js +470 -0
- package/dist/client/client.js.map +1 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.js +4 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/lobby.d.ts +40 -0
- package/dist/client/lobby.js +122 -0
- package/dist/client/lobby.js.map +1 -0
- package/dist/client/rtc.d.ts +17 -0
- package/dist/client/rtc.js +102 -0
- package/dist/client/rtc.js.map +1 -0
- package/dist/core/budget.d.ts +27 -0
- package/dist/core/budget.js +39 -0
- package/dist/core/budget.js.map +1 -0
- package/dist/core/endpoint.d.ts +144 -0
- package/dist/core/endpoint.js +501 -0
- package/dist/core/endpoint.js.map +1 -0
- package/dist/core/lobby.d.ts +59 -0
- package/dist/core/lobby.js +53 -0
- package/dist/core/lobby.js.map +1 -0
- package/dist/core/protocol.d.ts +52 -0
- package/dist/core/protocol.js +100 -0
- package/dist/core/protocol.js.map +1 -0
- package/dist/core/reliable.d.ts +52 -0
- package/dist/core/reliable.js +116 -0
- package/dist/core/reliable.js.map +1 -0
- package/dist/core/rtc.d.ts +28 -0
- package/dist/core/rtc.js +21 -0
- package/dist/core/rtc.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/netcode/clock.d.ts +15 -0
- package/dist/netcode/clock.js +37 -0
- package/dist/netcode/clock.js.map +1 -0
- package/dist/netcode/codec.d.ts +10 -0
- package/dist/netcode/codec.js +95 -0
- package/dist/netcode/codec.js.map +1 -0
- package/dist/netcode/index.d.ts +9 -0
- package/dist/netcode/index.js +10 -0
- package/dist/netcode/index.js.map +1 -0
- package/dist/netcode/inputs.d.ts +7 -0
- package/dist/netcode/inputs.js +43 -0
- package/dist/netcode/inputs.js.map +1 -0
- package/dist/netcode/interpolation.d.ts +44 -0
- package/dist/netcode/interpolation.js +101 -0
- package/dist/netcode/interpolation.js.map +1 -0
- package/dist/netcode/prediction.d.ts +40 -0
- package/dist/netcode/prediction.js +97 -0
- package/dist/netcode/prediction.js.map +1 -0
- package/dist/netcode/replication.d.ts +36 -0
- package/dist/netcode/replication.js +90 -0
- package/dist/netcode/replication.js.map +1 -0
- package/dist/netcode/snapshots.d.ts +29 -0
- package/dist/netcode/snapshots.js +78 -0
- package/dist/netcode/snapshots.js.map +1 -0
- package/dist/netcode/spatial.d.ts +16 -0
- package/dist/netcode/spatial.js +63 -0
- package/dist/netcode/spatial.js.map +1 -0
- package/dist/netcode/timing.d.ts +37 -0
- package/dist/netcode/timing.js +41 -0
- package/dist/netcode/timing.js.map +1 -0
- package/dist/server/index.d.ts +4 -0
- package/dist/server/index.js +5 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/lobby.d.ts +134 -0
- package/dist/server/lobby.js +462 -0
- package/dist/server/lobby.js.map +1 -0
- package/dist/server/rtc.d.ts +38 -0
- package/dist/server/rtc.js +102 -0
- package/dist/server/rtc.js.map +1 -0
- package/dist/server/server.d.ts +145 -0
- package/dist/server/server.js +457 -0
- package/dist/server/server.js.map +1 -0
- package/dist/server/turn.d.ts +22 -0
- package/dist/server/turn.js +52 -0
- package/dist/server/turn.js.map +1 -0
- package/docs/ADOPTING.md +64 -0
- package/docs/API.md +181 -0
- package/docs/ARCHITECTURE.md +101 -0
- package/docs/OPERATIONS.md +93 -0
- package/docs/RELEASE-CHECKLIST.md +25 -0
- package/package.json +100 -4
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
import { TokenBucket } from './budget.js';
|
|
2
|
+
import { ReliableEvents } from './reliable.js';
|
|
3
|
+
import { decodeFrame, encodeFrame, FrameKind, DEFAULT_STATE_BYTES, HEADER_BYTES, MAX_STATE_BYTES, MTU_STATE_BYTES, newer, stringify, isUint, utf8, fromUtf8, utf8Length, } from './protocol.js';
|
|
4
|
+
const DATAGRAM_EVENT_BYTES = 960;
|
|
5
|
+
export class Endpoint {
|
|
6
|
+
events;
|
|
7
|
+
stats = { bytesSent: 0, bytesReceived: 0, statesSent: 0, statesReceived: 0,
|
|
8
|
+
stale: 0, expired: 0, coalesced: 0, congested: 0, invalid: 0, fastTransitions: 0, datagramRttMs: 0,
|
|
9
|
+
eventsViaDatagram: 0, datagramEventFrames: 0, stateAcksSent: 0, stateAcksReceived: 0, impairedDrops: 0 };
|
|
10
|
+
onState = () => { };
|
|
11
|
+
onEvent = () => { };
|
|
12
|
+
onFastDown = () => { };
|
|
13
|
+
onFastChange = () => { };
|
|
14
|
+
onEventAck = () => { };
|
|
15
|
+
/** The peer has seen state `seq` on `stream` (only for states sent with `ack: true`). */
|
|
16
|
+
onStateAck = () => { };
|
|
17
|
+
reliable;
|
|
18
|
+
datagram;
|
|
19
|
+
epoch = 0;
|
|
20
|
+
sequence = new Map();
|
|
21
|
+
received = new Map();
|
|
22
|
+
queued = new Map();
|
|
23
|
+
acksOut = new Map();
|
|
24
|
+
acksIn = new Map();
|
|
25
|
+
lastAckSentAt = -Infinity;
|
|
26
|
+
lastEventSent = 0;
|
|
27
|
+
datagramAcked = 0;
|
|
28
|
+
ackDue = false;
|
|
29
|
+
lastProbe = -Infinity;
|
|
30
|
+
proofAt = -Infinity;
|
|
31
|
+
attachedAt = 0;
|
|
32
|
+
probes = new Map();
|
|
33
|
+
probeSeq = 0;
|
|
34
|
+
fast = false;
|
|
35
|
+
now;
|
|
36
|
+
budget;
|
|
37
|
+
highWater;
|
|
38
|
+
maxStreams;
|
|
39
|
+
probeInterval;
|
|
40
|
+
probeTimeout;
|
|
41
|
+
maxStateBytes;
|
|
42
|
+
datagramStateBytes;
|
|
43
|
+
datagramEvents;
|
|
44
|
+
stateAckInterval;
|
|
45
|
+
impairment;
|
|
46
|
+
constructor(o = {}) {
|
|
47
|
+
this.now = o.now ?? (() => performance.now());
|
|
48
|
+
const rate = o.bytesPerSecond ?? 32 * 1024;
|
|
49
|
+
this.budget = new TokenBucket(rate, o.burstBytes ?? Math.max(rate / 2, 16 * 1024), this.now());
|
|
50
|
+
this.highWater = o.maxBufferedBytes ?? 64 * 1024;
|
|
51
|
+
this.maxStreams = o.maxStreams ?? 1024;
|
|
52
|
+
this.probeInterval = o.probeIntervalMs ?? 250;
|
|
53
|
+
this.probeTimeout = o.probeTimeoutMs ?? 1500;
|
|
54
|
+
this.maxStateBytes = o.maxStateBytes ?? DEFAULT_STATE_BYTES;
|
|
55
|
+
this.datagramStateBytes = o.datagramStateBytes ?? 8 * 1024;
|
|
56
|
+
this.datagramEvents = o.datagramEvents ?? true;
|
|
57
|
+
this.stateAckInterval = o.stateAckIntervalMs ?? 50;
|
|
58
|
+
this.events = new ReliableEvents(o.events);
|
|
59
|
+
if (!(this.highWater > 0) || !isUint(this.maxStreams, 65536) || this.maxStreams < 1 ||
|
|
60
|
+
!(this.probeInterval >= 10) || !(this.probeTimeout >= this.probeInterval * 2) ||
|
|
61
|
+
!isUint(this.maxStateBytes, MAX_STATE_BYTES) || this.maxStateBytes < 1 ||
|
|
62
|
+
!(this.datagramStateBytes >= MTU_STATE_BYTES) || !(this.stateAckInterval >= 0))
|
|
63
|
+
throw new RangeError('Invalid endpoint limits');
|
|
64
|
+
if (o.impair)
|
|
65
|
+
this.setImpairment(o.impair);
|
|
66
|
+
}
|
|
67
|
+
get active() { return !!this.reliable?.open; }
|
|
68
|
+
get fastActive() { return this.fast && !!this.datagram?.open && this.now() - this.proofAt <= this.probeTimeout; }
|
|
69
|
+
get pendingStates() { return this.queued.size; }
|
|
70
|
+
get connectionEpoch() { return this.epoch; }
|
|
71
|
+
get maxFrameBytes() { return this.maxStateBytes + HEADER_BYTES; }
|
|
72
|
+
/** Newest seq the peer reported for an acknowledged stream in this connection epoch. */
|
|
73
|
+
stateAck(stream) { return this.acksIn.get(stream); }
|
|
74
|
+
setImpairment(i) {
|
|
75
|
+
if (!i) {
|
|
76
|
+
this.impairment = undefined;
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const { lagMs = 0, jitterMs = 0, loss = 0, duplicate = 0 } = i;
|
|
80
|
+
if (![lagMs, jitterMs].every(v => Number.isFinite(v) && v >= 0 && v <= 10000) ||
|
|
81
|
+
![loss, duplicate].every(v => Number.isFinite(v) && v >= 0 && v <= 1))
|
|
82
|
+
throw new RangeError('Invalid impairment');
|
|
83
|
+
this.impairment = lagMs || jitterMs || loss || duplicate ? { lagMs, jitterMs, loss, duplicate } : undefined;
|
|
84
|
+
}
|
|
85
|
+
get impaired() { return this.impairment && { ...this.impairment }; }
|
|
86
|
+
attach(epoch, reliable) {
|
|
87
|
+
if (!isUint(epoch) || !epoch)
|
|
88
|
+
throw new Error('Invalid epoch');
|
|
89
|
+
this.detach();
|
|
90
|
+
this.epoch = epoch;
|
|
91
|
+
this.reliable = this.impairReliable(reliable);
|
|
92
|
+
this.ackDue = this.events.received > 0;
|
|
93
|
+
this.lastEventSent = this.events.acknowledged;
|
|
94
|
+
this.datagramAcked = 0;
|
|
95
|
+
this.sequence.clear();
|
|
96
|
+
this.received.clear();
|
|
97
|
+
this.acksOut.clear();
|
|
98
|
+
this.acksIn.clear();
|
|
99
|
+
for (const e of this.events.entries()) {
|
|
100
|
+
e.datagramAt = -Infinity;
|
|
101
|
+
e.datagramTries = 0;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
detach() {
|
|
105
|
+
this.dropDatagram(false);
|
|
106
|
+
this.reliable = undefined;
|
|
107
|
+
this.queued.clear();
|
|
108
|
+
}
|
|
109
|
+
attachDatagram(link) {
|
|
110
|
+
this.dropDatagram(false);
|
|
111
|
+
this.datagram = this.impairDatagram(link);
|
|
112
|
+
this.attachedAt = this.now();
|
|
113
|
+
this.lastProbe = -Infinity;
|
|
114
|
+
this.proofAt = -Infinity;
|
|
115
|
+
this.probes.clear();
|
|
116
|
+
}
|
|
117
|
+
dropDatagram(notify = true) {
|
|
118
|
+
const d = this.datagram;
|
|
119
|
+
this.datagram = undefined;
|
|
120
|
+
this.proofAt = -Infinity;
|
|
121
|
+
this.probes.clear();
|
|
122
|
+
this.setFast(false);
|
|
123
|
+
try {
|
|
124
|
+
d?.close();
|
|
125
|
+
}
|
|
126
|
+
catch { /* already closed */ }
|
|
127
|
+
if (d && notify)
|
|
128
|
+
this.onFastDown();
|
|
129
|
+
}
|
|
130
|
+
setFast(next) {
|
|
131
|
+
if (next !== this.fast) {
|
|
132
|
+
this.fast = next;
|
|
133
|
+
this.stats.fastTransitions++;
|
|
134
|
+
this.onFastChange(next);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
sendControl(m) {
|
|
138
|
+
const data = stringify(m), ws = this.reliable;
|
|
139
|
+
if (!ws?.open || ws.bufferedAmount > this.highWater)
|
|
140
|
+
return false;
|
|
141
|
+
try {
|
|
142
|
+
if (!ws.send(data))
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
this.stats.bytesSent += utf8Length(data);
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
sendEvent(data) { const seq = this.events.push(data); this.flush(); return seq; }
|
|
152
|
+
/** Retains only the newest unsent payload per stream. Returns the state's seq (0 when offline).
|
|
153
|
+
* An accepted enqueue is not a delivery guarantee; use `ack: true` and onStateAck to learn what arrived. */
|
|
154
|
+
sendState(stream, data, time, o = {}) {
|
|
155
|
+
if (!this.active)
|
|
156
|
+
return 0;
|
|
157
|
+
if (!isUint(stream, 65535) || !Number.isFinite(time) || data.length > this.maxStateBytes ||
|
|
158
|
+
!(o.ttlMs === undefined || Number.isFinite(o.ttlMs) && o.ttlMs > 0) ||
|
|
159
|
+
!(o.priority === undefined || Number.isFinite(o.priority) && o.priority >= 0))
|
|
160
|
+
throw new RangeError('Invalid state');
|
|
161
|
+
if (!this.sequence.has(stream) && this.sequence.size >= this.maxStreams)
|
|
162
|
+
throw new Error('State stream limit');
|
|
163
|
+
const seq = ((this.sequence.get(stream) ?? 0) + 1) >>> 0 || 1;
|
|
164
|
+
this.sequence.set(stream, seq);
|
|
165
|
+
const old = this.queued.get(stream);
|
|
166
|
+
if (old)
|
|
167
|
+
this.stats.coalesced++;
|
|
168
|
+
const now = this.now();
|
|
169
|
+
this.queued.set(stream, { frame: { kind: o.ack ? FrameKind.stateAcked : FrameKind.state, epoch: this.epoch, stream, seq, time, payload: data.slice() },
|
|
170
|
+
first: old?.first ?? now, deadline: now + (o.ttlMs ?? 100), priority: o.priority ?? 1 });
|
|
171
|
+
return seq;
|
|
172
|
+
}
|
|
173
|
+
receiveControl(m) {
|
|
174
|
+
if (m.e !== this.epoch || !this.active)
|
|
175
|
+
return false;
|
|
176
|
+
if (m.t === 'event') {
|
|
177
|
+
if (typeof m.s !== 'number' || !('d' in m))
|
|
178
|
+
throw new Error('Invalid event');
|
|
179
|
+
this.events.receive(m.s, m.d, this.onEvent);
|
|
180
|
+
this.ackDue = !this.sendControl({ t: 'ack', e: this.epoch, s: this.events.received });
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
if (m.t === 'ack') {
|
|
184
|
+
if (typeof m.s !== 'number')
|
|
185
|
+
throw new Error('Invalid acknowledgement');
|
|
186
|
+
if (this.events.ack(m.s))
|
|
187
|
+
this.onEventAck(m.s);
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
receiveBinary(bytes, via) {
|
|
193
|
+
this.stats.bytesReceived += bytes.length;
|
|
194
|
+
if (!this.active)
|
|
195
|
+
return;
|
|
196
|
+
const f = decodeFrame(bytes, this.maxFrameBytes);
|
|
197
|
+
if (!f) {
|
|
198
|
+
this.stats.invalid++;
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (f.epoch !== this.epoch || (via === 'rtc' && !this.datagram)) {
|
|
202
|
+
this.stats.stale++;
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
switch (f.kind) {
|
|
206
|
+
case FrameKind.probe:
|
|
207
|
+
if (via === 'rtc')
|
|
208
|
+
this.sendFast(encodeFrame({ ...f, kind: FrameKind.reply }));
|
|
209
|
+
return;
|
|
210
|
+
case FrameKind.reply: {
|
|
211
|
+
if (via !== 'rtc')
|
|
212
|
+
return;
|
|
213
|
+
const sent = this.probes.get(f.seq);
|
|
214
|
+
if (sent === undefined || sent !== f.time)
|
|
215
|
+
return;
|
|
216
|
+
this.probes.delete(f.seq);
|
|
217
|
+
const rtt = this.now() - sent;
|
|
218
|
+
if (rtt < 0 || rtt > this.probeTimeout)
|
|
219
|
+
return;
|
|
220
|
+
this.proofAt = this.now();
|
|
221
|
+
this.stats.datagramRttMs = rtt;
|
|
222
|
+
this.setFast(true);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
case FrameKind.events: return this.receiveDatagramEvents(f);
|
|
226
|
+
case FrameKind.sack: return this.receiveStateAcks(f);
|
|
227
|
+
}
|
|
228
|
+
const prior = this.received.get(f.stream);
|
|
229
|
+
if (prior !== undefined && !newer(f.seq, prior)) {
|
|
230
|
+
this.stats.stale++;
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
if (prior === undefined && this.received.size >= this.maxStreams) {
|
|
234
|
+
this.stats.invalid++;
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
this.received.set(f.stream, f.seq);
|
|
238
|
+
this.stats.statesReceived++;
|
|
239
|
+
if (f.kind === FrameKind.stateAcked)
|
|
240
|
+
this.acksOut.set(f.stream, f.seq);
|
|
241
|
+
this.onState({ stream: f.stream, seq: f.seq, time: f.time, data: f.payload, via });
|
|
242
|
+
}
|
|
243
|
+
receiveDatagramEvents(f) {
|
|
244
|
+
if (f.seq <= this.events.sentThrough && this.events.ack(f.seq))
|
|
245
|
+
this.onEventAck(f.seq);
|
|
246
|
+
if (!f.payload.length)
|
|
247
|
+
return;
|
|
248
|
+
let list;
|
|
249
|
+
try {
|
|
250
|
+
list = JSON.parse(fromUtf8(f.payload));
|
|
251
|
+
}
|
|
252
|
+
catch {
|
|
253
|
+
this.stats.invalid++;
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
if (!Array.isArray(list) || list.length > 64) {
|
|
257
|
+
this.stats.invalid++;
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
let delivered = 0;
|
|
261
|
+
for (const item of list) {
|
|
262
|
+
if (!Array.isArray(item) || item.length !== 2 || !Number.isSafeInteger(item[0])) {
|
|
263
|
+
this.stats.invalid++;
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
try {
|
|
267
|
+
delivered += this.events.receive(item[0], item[1], this.onEvent);
|
|
268
|
+
}
|
|
269
|
+
catch {
|
|
270
|
+
this.stats.invalid++;
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
if (delivered) {
|
|
275
|
+
this.stats.eventsViaDatagram += delivered;
|
|
276
|
+
this.ackDue = true;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
receiveStateAcks(f) {
|
|
280
|
+
const p = f.payload;
|
|
281
|
+
if (p.length % 6) {
|
|
282
|
+
this.stats.invalid++;
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
const v = new DataView(p.buffer, p.byteOffset, p.byteLength);
|
|
286
|
+
for (let at = 0; at < p.length; at += 6) {
|
|
287
|
+
const stream = v.getUint16(at, true), seq = v.getUint32(at + 2, true), sent = this.sequence.get(stream);
|
|
288
|
+
if (sent === undefined || newer(seq, sent))
|
|
289
|
+
continue;
|
|
290
|
+
const prior = this.acksIn.get(stream);
|
|
291
|
+
if (prior !== undefined && !newer(seq, prior))
|
|
292
|
+
continue;
|
|
293
|
+
this.acksIn.set(stream, seq);
|
|
294
|
+
this.stats.stateAcksReceived++;
|
|
295
|
+
this.onStateAck(stream, seq);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
sendFast(b) {
|
|
299
|
+
const d = this.datagram;
|
|
300
|
+
if (!d?.open || d.bufferedAmount > this.highWater)
|
|
301
|
+
return false;
|
|
302
|
+
try {
|
|
303
|
+
if (!d.send(b))
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
catch {
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
309
|
+
this.stats.bytesSent += b.length;
|
|
310
|
+
return true;
|
|
311
|
+
}
|
|
312
|
+
/** Binary on the datagram path when it is proven, else the WebSocket. */
|
|
313
|
+
sendBinary(b, preferFast) {
|
|
314
|
+
const ws = this.reliable;
|
|
315
|
+
if (preferFast && this.fastActive && this.datagram && this.datagram.bufferedAmount <= this.highWater)
|
|
316
|
+
return this.sendFast(b);
|
|
317
|
+
if (!ws?.open || ws.bufferedAmount > this.highWater)
|
|
318
|
+
return false;
|
|
319
|
+
try {
|
|
320
|
+
if (!ws.send(b))
|
|
321
|
+
return false;
|
|
322
|
+
}
|
|
323
|
+
catch {
|
|
324
|
+
return false;
|
|
325
|
+
}
|
|
326
|
+
this.stats.bytesSent += b.length;
|
|
327
|
+
return true;
|
|
328
|
+
}
|
|
329
|
+
pump() {
|
|
330
|
+
const now = this.now(), d = this.datagram;
|
|
331
|
+
if (d) {
|
|
332
|
+
if ((!d.open && now - this.attachedAt > this.probeTimeout) ||
|
|
333
|
+
(this.fast && now - this.proofAt > this.probeTimeout) ||
|
|
334
|
+
(!this.fast && now - this.attachedAt > this.probeTimeout * 2))
|
|
335
|
+
this.dropDatagram();
|
|
336
|
+
else if (d.open && now - this.lastProbe >= this.probeInterval) {
|
|
337
|
+
this.lastProbe = now;
|
|
338
|
+
const seq = this.probeSeq = (this.probeSeq + 1) >>> 0;
|
|
339
|
+
this.probes.set(seq, now);
|
|
340
|
+
for (const [s, at] of this.probes)
|
|
341
|
+
if (now - at > this.probeTimeout)
|
|
342
|
+
this.probes.delete(s);
|
|
343
|
+
this.sendFast(encodeFrame({ kind: FrameKind.probe, epoch: this.epoch, stream: 0, seq, time: now, payload: new Uint8Array() }));
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
this.flush();
|
|
347
|
+
}
|
|
348
|
+
flush(maxPackets = 8) {
|
|
349
|
+
const ws = this.reliable, now = this.now();
|
|
350
|
+
if (!ws?.open)
|
|
351
|
+
return;
|
|
352
|
+
if (this.ackDue)
|
|
353
|
+
this.ackDue = !this.sendControl({ t: 'ack', e: this.epoch, s: this.events.received });
|
|
354
|
+
for (const e of this.events.entries()) {
|
|
355
|
+
if (e.seq <= this.lastEventSent)
|
|
356
|
+
continue;
|
|
357
|
+
const encoded = `{"t":"event","e":${this.epoch},"s":${e.seq},"d":${e.text}}`;
|
|
358
|
+
const size = utf8Length(encoded);
|
|
359
|
+
if (ws.bufferedAmount > this.highWater || !this.budget.take(size, now))
|
|
360
|
+
break;
|
|
361
|
+
try {
|
|
362
|
+
if (!ws.send(encoded))
|
|
363
|
+
break;
|
|
364
|
+
}
|
|
365
|
+
catch {
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
368
|
+
this.events.sent(e.seq);
|
|
369
|
+
this.lastEventSent = e.seq;
|
|
370
|
+
this.stats.bytesSent += size;
|
|
371
|
+
}
|
|
372
|
+
if (this.fastActive)
|
|
373
|
+
this.flushDatagramEvents(now);
|
|
374
|
+
if (this.acksOut.size && now - this.lastAckSentAt >= this.stateAckInterval)
|
|
375
|
+
this.flushStateAcks(now);
|
|
376
|
+
for (const [id, q] of this.queued)
|
|
377
|
+
if (q.deadline <= now) {
|
|
378
|
+
this.queued.delete(id);
|
|
379
|
+
this.stats.expired++;
|
|
380
|
+
}
|
|
381
|
+
if (!this.queued.size)
|
|
382
|
+
return;
|
|
383
|
+
const queue = [...this.queued.values()].sort((a, b) => (b.priority + (now - b.first) / 100) - (a.priority + (now - a.first) / 100));
|
|
384
|
+
let count = 0;
|
|
385
|
+
for (const q of queue) {
|
|
386
|
+
if (count++ >= maxPackets)
|
|
387
|
+
break;
|
|
388
|
+
const b = encodeFrame(q.frame);
|
|
389
|
+
if (!this.budget.take(b.length, now))
|
|
390
|
+
break;
|
|
391
|
+
if (!this.sendBinary(b, q.frame.payload.length <= this.datagramStateBytes)) {
|
|
392
|
+
this.stats.congested++;
|
|
393
|
+
break;
|
|
394
|
+
}
|
|
395
|
+
this.stats.statesSent++;
|
|
396
|
+
this.queued.delete(q.frame.stream);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
/** Copies of WebSocket-sent, unacknowledged events, retried on the datagram path for UDP-like latency. */
|
|
400
|
+
flushDatagramEvents(now) {
|
|
401
|
+
const retry = Math.max(40, Math.min(200, this.stats.datagramRttMs * 1.5 + 10));
|
|
402
|
+
const items = [];
|
|
403
|
+
let bytes = 2;
|
|
404
|
+
if (this.datagramEvents)
|
|
405
|
+
for (const e of this.events.entries()) {
|
|
406
|
+
if (e.seq > this.lastEventSent)
|
|
407
|
+
break;
|
|
408
|
+
if (e.datagramTries >= 6 || now - e.datagramAt < retry || e.bytes - 64 > DATAGRAM_EVENT_BYTES)
|
|
409
|
+
continue;
|
|
410
|
+
const item = `[${e.seq},${e.text}]`, size = utf8Length(item) + 1;
|
|
411
|
+
if (bytes + size > DATAGRAM_EVENT_BYTES || items.length >= 64)
|
|
412
|
+
break;
|
|
413
|
+
items.push(item);
|
|
414
|
+
bytes += size;
|
|
415
|
+
e.datagramAt = now;
|
|
416
|
+
e.datagramTries++;
|
|
417
|
+
}
|
|
418
|
+
const ackChanged = this.events.received !== this.datagramAcked;
|
|
419
|
+
if (!items.length && !ackChanged)
|
|
420
|
+
return;
|
|
421
|
+
const payload = utf8('[' + items.join(',') + ']');
|
|
422
|
+
if (this.sendFast(encodeFrame({ kind: FrameKind.events, epoch: this.epoch, stream: 0, seq: this.events.received >>> 0, time: now, payload }))) {
|
|
423
|
+
this.datagramAcked = this.events.received;
|
|
424
|
+
this.stats.datagramEventFrames++;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
flushStateAcks(now) {
|
|
428
|
+
const pairs = [...this.acksOut].slice(0, 150), p = new Uint8Array(pairs.length * 6), v = new DataView(p.buffer);
|
|
429
|
+
pairs.forEach(([stream, seq], i) => { v.setUint16(i * 6, stream, true); v.setUint32(i * 6 + 2, seq, true); });
|
|
430
|
+
if (this.sendBinary(encodeFrame({ kind: FrameKind.sack, epoch: this.epoch, stream: 0, seq: 0, time: now, payload: p }), true)) {
|
|
431
|
+
for (const [stream, seq] of pairs)
|
|
432
|
+
if (this.acksOut.get(stream) === seq)
|
|
433
|
+
this.acksOut.delete(stream);
|
|
434
|
+
this.lastAckSentAt = now;
|
|
435
|
+
this.stats.stateAcksSent++;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
/** Delays a stream-like link without ever reordering it: one queue, one timer. */
|
|
439
|
+
impairReliable(link) {
|
|
440
|
+
let tail = 0, timer;
|
|
441
|
+
const queue = [];
|
|
442
|
+
const drain = () => {
|
|
443
|
+
timer = undefined;
|
|
444
|
+
const t = performance.now();
|
|
445
|
+
while (queue.length && queue[0].at <= t + 1) {
|
|
446
|
+
const { data } = queue.shift();
|
|
447
|
+
if (link.open)
|
|
448
|
+
try {
|
|
449
|
+
link.send(data);
|
|
450
|
+
}
|
|
451
|
+
catch { /* reconnect owns recovery */ }
|
|
452
|
+
}
|
|
453
|
+
if (queue.length)
|
|
454
|
+
timer = setTimeout(drain, queue[0].at - t);
|
|
455
|
+
};
|
|
456
|
+
const self = this;
|
|
457
|
+
return {
|
|
458
|
+
get open() { return link.open; }, get bufferedAmount() { return link.bufferedAmount; },
|
|
459
|
+
close: () => { queue.length = 0; clearTimeout(timer); timer = undefined; link.close(); },
|
|
460
|
+
send(data) {
|
|
461
|
+
const i = self.impairment;
|
|
462
|
+
if (!i && !queue.length)
|
|
463
|
+
return link.send(data);
|
|
464
|
+
if (!link.open)
|
|
465
|
+
return false;
|
|
466
|
+
const t = performance.now(), at = Math.max(tail, t + (i?.lagMs ?? 0) + Math.random() * (i?.jitterMs ?? 0));
|
|
467
|
+
tail = at;
|
|
468
|
+
queue.push({ at, data: typeof data === 'string' ? data : data.slice() });
|
|
469
|
+
if (!timer)
|
|
470
|
+
timer = setTimeout(drain, at - t);
|
|
471
|
+
return true;
|
|
472
|
+
},
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
impairDatagram(link) {
|
|
476
|
+
const self = this;
|
|
477
|
+
return {
|
|
478
|
+
get open() { return link.open; }, get bufferedAmount() { return link.bufferedAmount; }, close: () => link.close(),
|
|
479
|
+
send(data) {
|
|
480
|
+
const i = self.impairment;
|
|
481
|
+
if (!i)
|
|
482
|
+
return link.send(data);
|
|
483
|
+
if (!link.open)
|
|
484
|
+
return false;
|
|
485
|
+
const copies = Math.random() < i.loss ? 0 : Math.random() < i.duplicate ? 2 : 1;
|
|
486
|
+
if (!copies)
|
|
487
|
+
self.stats.impairedDrops++;
|
|
488
|
+
for (let n = 0; n < copies; n++) {
|
|
489
|
+
const copy = data.slice();
|
|
490
|
+
setTimeout(() => { if (link.open)
|
|
491
|
+
try {
|
|
492
|
+
link.send(copy);
|
|
493
|
+
}
|
|
494
|
+
catch { /* dropped */ } }, i.lagMs + Math.random() * i.jitterMs);
|
|
495
|
+
}
|
|
496
|
+
return true;
|
|
497
|
+
},
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
//# sourceMappingURL=endpoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint.js","sourceRoot":"","sources":["../../src/core/endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAw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M,EAAE,GAAG,CAAC,CAAC,QAAS,CAAC,CAAC;gBAChI,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Json } from './protocol.js';
|
|
2
|
+
/** Lobby messages ride on reliable events under this key; the application's own events never use it. */
|
|
3
|
+
export declare const LOBBY_KEY = "$lobby";
|
|
4
|
+
export type Visibility = 'public' | 'private';
|
|
5
|
+
export interface MemberView {
|
|
6
|
+
seat: number;
|
|
7
|
+
name: string;
|
|
8
|
+
ready: boolean;
|
|
9
|
+
connected: boolean;
|
|
10
|
+
host: boolean;
|
|
11
|
+
meta: Record<string, Json>;
|
|
12
|
+
}
|
|
13
|
+
export interface RoomView {
|
|
14
|
+
code: string;
|
|
15
|
+
mode: string;
|
|
16
|
+
visibility: Visibility;
|
|
17
|
+
phase: string;
|
|
18
|
+
maxMembers: number;
|
|
19
|
+
meta: Record<string, Json>;
|
|
20
|
+
/** The viewer's own seat. */
|
|
21
|
+
you: number;
|
|
22
|
+
members: MemberView[];
|
|
23
|
+
/** Server clock (ms) when the ready countdown ends, or null. Compare with client.clock.serverTime(). */
|
|
24
|
+
countdownEndsAt: number | null;
|
|
25
|
+
}
|
|
26
|
+
export interface CreateRequest {
|
|
27
|
+
mode?: string;
|
|
28
|
+
visibility?: Visibility;
|
|
29
|
+
maxMembers?: number;
|
|
30
|
+
meta?: Record<string, Json>;
|
|
31
|
+
name?: string;
|
|
32
|
+
memberMeta?: Record<string, Json>;
|
|
33
|
+
/** Anything the game needs to set the room up (a save, a course). Goes to onCreate; never shown to other members. */
|
|
34
|
+
init?: Json;
|
|
35
|
+
}
|
|
36
|
+
export interface JoinRequest {
|
|
37
|
+
code: string;
|
|
38
|
+
name?: string;
|
|
39
|
+
memberMeta?: Record<string, Json>;
|
|
40
|
+
}
|
|
41
|
+
export interface QuickPlayRequest {
|
|
42
|
+
mode?: string;
|
|
43
|
+
/** Only rooms whose meta has these exact values (a build id, a region). */
|
|
44
|
+
match?: Record<string, Json>;
|
|
45
|
+
name?: string;
|
|
46
|
+
memberMeta?: Record<string, Json>;
|
|
47
|
+
/** Used when no room fits and a new public one is made. */
|
|
48
|
+
create?: Omit<CreateRequest, 'visibility' | 'mode' | 'name' | 'memberMeta'>;
|
|
49
|
+
}
|
|
50
|
+
/** Readable room codes: no I/O (they look like 1/0). */
|
|
51
|
+
export declare const CODE_ALPHABET = "ABCDEFGHJKLMNPQRSTUVWXYZ";
|
|
52
|
+
export declare function normalizeCode(code: unknown): string | null;
|
|
53
|
+
export declare function cleanName(name: unknown, max?: number): string;
|
|
54
|
+
/** Small flat JSON maps (meta) only: bounded keys, scalar values or short arrays. */
|
|
55
|
+
export declare function cleanMeta(v: unknown, maxBytes?: number): Record<string, Json> | null;
|
|
56
|
+
export declare function metaMatches(meta: Record<string, Json>, match: Record<string, Json> | undefined): boolean;
|
|
57
|
+
export declare function isLobbyMessage(d: Json): d is {
|
|
58
|
+
[LOBBY_KEY]: string;
|
|
59
|
+
} & Record<string, Json>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** Lobby messages ride on reliable events under this key; the application's own events never use it. */
|
|
2
|
+
export const LOBBY_KEY = '$lobby';
|
|
3
|
+
/** Readable room codes: no I/O (they look like 1/0). */
|
|
4
|
+
export const CODE_ALPHABET = 'ABCDEFGHJKLMNPQRSTUVWXYZ';
|
|
5
|
+
export function normalizeCode(code) {
|
|
6
|
+
if (typeof code !== 'string')
|
|
7
|
+
return null;
|
|
8
|
+
const c = code.trim().toUpperCase();
|
|
9
|
+
return /^[A-Z0-9]{3,12}$/.test(c) ? c : null;
|
|
10
|
+
}
|
|
11
|
+
const range = (a, b) => String.fromCharCode(a) + '-' + String.fromCharCode(b);
|
|
12
|
+
/** Control, zero-width and bidi-override characters: never allowed in a shown name. */
|
|
13
|
+
const INVISIBLE = new RegExp('[' + [range(0, 31), range(127, 159), range(0x200b, 0x200f), range(0x2028, 0x202e), range(0x2066, 0x2069)].join('') + ']', 'g');
|
|
14
|
+
export function cleanName(name, max = 16) {
|
|
15
|
+
if (typeof name !== 'string')
|
|
16
|
+
return '';
|
|
17
|
+
return name.replace(/\s+/g, ' ').replace(INVISIBLE, '').replace(/ +/g, ' ').trim().slice(0, max);
|
|
18
|
+
}
|
|
19
|
+
/** Small flat JSON maps (meta) only: bounded keys, scalar values or short arrays. */
|
|
20
|
+
export function cleanMeta(v, maxBytes = 1024) {
|
|
21
|
+
if (v === undefined || v === null)
|
|
22
|
+
return {};
|
|
23
|
+
if (typeof v !== 'object' || Array.isArray(v))
|
|
24
|
+
return null;
|
|
25
|
+
let text;
|
|
26
|
+
try {
|
|
27
|
+
text = JSON.stringify(v);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
if (text.length > maxBytes)
|
|
33
|
+
return null;
|
|
34
|
+
const out = {};
|
|
35
|
+
for (const [k, x] of Object.entries(v)) {
|
|
36
|
+
if (!/^[\w.-]{1,32}$/.test(k) || ['__proto__', 'constructor', 'prototype'].includes(k))
|
|
37
|
+
return null;
|
|
38
|
+
out[k] = JSON.parse(JSON.stringify(x ?? null));
|
|
39
|
+
}
|
|
40
|
+
return out;
|
|
41
|
+
}
|
|
42
|
+
export function metaMatches(meta, match) {
|
|
43
|
+
if (!match)
|
|
44
|
+
return true;
|
|
45
|
+
for (const k of Object.keys(match))
|
|
46
|
+
if (JSON.stringify(meta[k] ?? null) !== JSON.stringify(match[k] ?? null))
|
|
47
|
+
return false;
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
export function isLobbyMessage(d) {
|
|
51
|
+
return !!d && typeof d === 'object' && !Array.isArray(d) && typeof d[LOBBY_KEY] === 'string';
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=lobby.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lobby.js","sourceRoot":"","sources":["../../src/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