{"record":{"id":"248c32bc95e185f9","repo":"ppy/osu","slug":"binary-message-type-not-supported","errorCode":null,"errorMessage":"Binary message type not supported.","messagePattern":"Binary message type not supported\\.","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"osu.Game/Online/Notifications/WebSocket/WebSocketNotificationsClient.cs","lineNumber":74,"sourceCode":"                            {\r\n                                SocketMessage? message = JsonConvert.DeserializeObject<SocketMessage>(messageResult.ToString());\r\n                                messageResult.Clear();\r\n\r\n                                Debug.Assert(message != null);\r\n\r\n                                if (message.Error != null)\r\n                                {\r\n                                    Logger.Log($\"{GetType().ReadableName()} error: {message.Error}\", LoggingTarget.Network);\r\n                                    break;\r\n                                }\r\n\r\n                                MessageReceived?.Invoke(message);\r\n                            }\r\n\r\n                            break;\r\n\r\n                        case WebSocketMessageType.Binary:\r\n                            throw new NotImplementedException(\"Binary message type not supported.\");\r\n\r\n                        case WebSocketMessageType.Close:\r\n                            throw new WebException(\"Connection closed by remote host.\");\r\n                    }\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    await InvokeClosed(ex).ConfigureAwait(false);\r\n                    return;\r\n                }\r\n            }\r\n        }, cancellationToken);\r\n\r\n        private async Task closeAsync()\r\n        {\r\n            try\r\n            {\r\n                await socket.CloseAsync(WebSocketCloseStatus.NormalClosure, @\"Disconnecting\", CancellationToken.None).ConfigureAwait(false);\r","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/ppy/osu/blob/d9c73e12adff2feaae4a3e158d36fe5883faf6ca/osu.Game/Online/Notifications/WebSocket/WebSocketNotificationsClient.cs#L56-L92","documentation":"Thrown as NotImplementedException by WebSocketNotificationsClient when a WebSocket frame arrives with type Binary. The client only understands text (JSON) notification frames; binary frames indicate either a server bug or a protocol mismatch.","triggerScenarios":"The notifications WebSocket server sends a message whose WebSocketMessageType is Binary rather than Text. The receive loop has no handler for binary and throws.","commonSituations":"Server-side change to the notifications protocol; connecting to a non-conforming or wrong-version server; a proxy that re-frames messages as binary.","solutions":["Confirm the server is the expected version and only sends text frames.","If binary is legitimately possible, handle it before the throw (parse or log and continue) instead of treating it as fatal.","Catch the exception at the connection-closed handler to trigger a reconnect rather than killing notifications permanently."],"exampleFix":"// before\ncase WebSocketMessageType.Binary:\n    throw new NotImplementedException(\"Binary message type not supported.\");\n\n// after\ncase WebSocketMessageType.Binary:\n    Logger.Log(\"Ignored unsupported binary notification frame.\", LoggingTarget.Network);\n    break;","handlingStrategy":"try-catch","validationCode":"// before receiving, there is no per-frame type to validate; the guard is in the receive loop.","typeGuard":null,"tryCatchPattern":"// the existing loop already catches and calls InvokeClosed(ex);\n// ensure a reconnect strategy is attached to the Closed event.","preventionTips":["Confirm the server contract is text-only JSON before deploying.","Log received message types during integration to catch binary frames early.","Treat this as fatal-per-connection, not fatal-per-session: reconnect."],"tags":["websocket","notifications","network","not-implemented"],"backgroundTag":null,"analyzedSha":"d9c73e12adff2feaae4a3e158d36fe5883faf6ca","analyzedAt":"2026-08-13T14:12:54.015Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}