{"record":{"id":"d9c07709aec4a6fe","repo":"SnapDrop/snapdrop","slug":"ws-unkown-message-type","errorCode":null,"errorMessage":"WS: unkown message type","messagePattern":"WS: unkown message type","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/scripts/network.js","lineNumber":48,"sourceCode":"                Events.fire('peers', msg.peers);\n                break;\n            case 'peer-joined':\n                Events.fire('peer-joined', msg.peer);\n                break;\n            case 'peer-left':\n                Events.fire('peer-left', msg.peerId);\n                break;\n            case 'signal':\n                Events.fire('signal', msg);\n                break;\n            case 'ping':\n                this.send({ type: 'pong' });\n                break;\n            case 'display-name':\n                Events.fire('display-name', msg);\n                break;\n            default:\n                console.error('WS: unkown message type', msg);\n        }\n    }\n\n    send(message) {\n        if (!this._isConnected()) return;\n        this._socket.send(JSON.stringify(message));\n    }\n\n    _endpoint() {\n        // hack to detect if deployment or development environment\n        const protocol = location.protocol.startsWith('https') ? 'wss' : 'ws';\n        const webrtc = window.isRtcSupported ? '/webrtc' : '/fallback';\n        const url = protocol + '://' + location.host + location.pathname + 'server' + webrtc;\n        return url;\n    }\n\n    _disconnect() {\n        this.send({ type: 'disconnect' });","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/SnapDrop/snapdrop/blob/b8b78cc22a672fd7c442f5a4866a8d9b0c05362e/client/scripts/network.js#L30-L66","documentation":"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.","triggerScenarios":"Thrown at client/scripts/network.js:48 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b8b78cc22a672fd7c442f5a4866a8d9b0c05362e","analyzedAt":"2026-09-02T16:11:56.727Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}