sam-coder-cli 1.0.30 → 1.0.31
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/bin/multiplayer-server.js +27 -0
- package/package.json +1 -1
|
@@ -302,6 +302,33 @@ class MultiplayerServer {
|
|
|
302
302
|
joinedAt: new Date().toISOString(),
|
|
303
303
|
lastSeen: new Date().toISOString()
|
|
304
304
|
};
|
|
305
|
+
|
|
306
|
+
// Add client to session
|
|
307
|
+
session.clients[clientId] = clientInfo;
|
|
308
|
+
this.clients.set(ws, clientInfo);
|
|
309
|
+
|
|
310
|
+
// Send session joined confirmation
|
|
311
|
+
ws.send(JSON.stringify({
|
|
312
|
+
type: 'session_joined',
|
|
313
|
+
sessionId,
|
|
314
|
+
clientId,
|
|
315
|
+
clientInfo,
|
|
316
|
+
isHost: clientInfo.isHost,
|
|
317
|
+
sessionInfo: {
|
|
318
|
+
id: session.id,
|
|
319
|
+
createdAt: session.createdAt,
|
|
320
|
+
clientCount: Object.keys(session.clients).length,
|
|
321
|
+
hostId: session.hostId
|
|
322
|
+
}
|
|
323
|
+
}));
|
|
324
|
+
|
|
325
|
+
// Notify other clients in the session
|
|
326
|
+
this.broadcastToSession(sessionId, {
|
|
327
|
+
type: 'agent_joined',
|
|
328
|
+
clientId,
|
|
329
|
+
clientInfo,
|
|
330
|
+
timestamp: new Date().toISOString()
|
|
331
|
+
}, clientId);
|
|
305
332
|
}
|
|
306
333
|
|
|
307
334
|
broadcastToSession(sessionId, message, excludeClientId = null) {
|