SnapDrop/snapdrop · error
WS: unkown message type
Error message
WS: unkown message type
What it means
Logged in the default branch of the message-type switch in _onMessage: the WebSocket server sent a message whose msg.type is not one of the known cases (peers, peer-joined, peer-left, signal, ping, display-name), i.e. the client and server protocol versions disagree or an unexpected/invalid type reached the dispatcher.
Source
Thrown at client/scripts/network.js:48
Events.fire('peers', msg.peers);
break;
case 'peer-joined':
Events.fire('peer-joined', msg.peer);
break;
case 'peer-left':
Events.fire('peer-left', msg.peerId);
break;
case 'signal':
Events.fire('signal', msg);
break;
case 'ping':
this.send({ type: 'pong' });
break;
case 'display-name':
Events.fire('display-name', msg);
break;
default:
console.error('WS: unkown message type', msg);
}
}
send(message) {
if (!this._isConnected()) return;
this._socket.send(JSON.stringify(message));
}
_endpoint() {
// hack to detect if deployment or development environment
const protocol = location.protocol.startsWith('https') ? 'wss' : 'ws';
const webrtc = window.isRtcSupported ? '/webrtc' : '/fallback';
const url = protocol + '://' + location.host + location.pathname + 'server' + webrtc;
return url;
}
_disconnect() {
this.send({ type: 'disconnect' });View on GitHub (pinned to b8b78cc22a)
Solutions
- Add a case for the new message type in the switch in _onMessage
- Make the default branch a no-op so unknown types are ignored
- Log msg.type along with the message to identify the unrecognized payload
- Update the client to a version matching the server's WebSocket protocol
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at client/scripts/network.js:48 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of SnapDrop/snapdrop@b8b78cc22a (2026-09-02).
Data as JSON: /api/errors/d9c07709aec4a6fe.
Report an issue: GitHub.