Only one Sighnstation can connect
This commit is contained in:
14
server.js
14
server.js
@@ -205,6 +205,20 @@ function handleMasterRegister(ws) {
|
||||
}
|
||||
|
||||
function handleSignatureRegister(ws) {
|
||||
// Check if another signature station is already connected
|
||||
if (signatureConnection && signatureConnection.readyState === WebSocket.OPEN) {
|
||||
// Inform the new station that another station is already connected
|
||||
ws.send(JSON.stringify({
|
||||
type: 'already_connected'
|
||||
}));
|
||||
console.log('⚠️ Neue Signatur-Station versucht sich zu verbinden, aber bereits eine Station verbunden');
|
||||
console.log('⚠️ Neue Station wurde informiert, alte Station bleibt aktiv');
|
||||
// Keep the old connection, don't replace it
|
||||
// Don't register the new connection as signatureConnection
|
||||
return; // Exit without registering the new connection
|
||||
}
|
||||
|
||||
// No existing connection, register this new one
|
||||
signatureConnection = ws;
|
||||
console.log('Signatur-Station registriert');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user