{"record":{"id":"77f0d7c52623a743","repo":"OrchardCMS/OrchardCore","slug":"binary-protocols-over-xmlhttprequest-not-implementing","errorCode":null,"errorMessage":"Binary protocols over XmlHttpRequest not implementing advanced features are not supported.","messagePattern":"Binary protocols over XmlHttpRequest not implementing advanced features are not supported\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/OrchardCore.Modules/OrchardCore.SignalR/wwwroot/Scripts/signalr.js","lineNumber":2261,"sourceCode":"    constructor(httpClient, logger, options) {\n        this._httpClient = httpClient;\n        this._logger = logger;\n        this._pollAbort = new AbortController_AbortController();\n        this._options = options;\n        this._running = false;\n        this.onreceive = null;\n        this.onclose = null;\n    }\n    async connect(url, transferFormat) {\n        Arg.isRequired(url, \"url\");\n        Arg.isRequired(transferFormat, \"transferFormat\");\n        Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\n        this._url = url;\n        this._logger.log(LogLevel.Trace, \"(LongPolling transport) Connecting.\");\n        // Allow binary format on Node and Browsers that support binary content (indicated by the presence of responseType property)\n        if (transferFormat === TransferFormat.Binary &&\n            (typeof XMLHttpRequest !== \"undefined\" && typeof new XMLHttpRequest().responseType !== \"string\")) {\n            throw new Error(\"Binary protocols over XmlHttpRequest not implementing advanced features are not supported.\");\n        }\n        const [name, value] = getUserAgentHeader();\n        const headers = { [name]: value, ...this._options.headers };\n        const pollOptions = {\n            abortSignal: this._pollAbort.signal,\n            headers,\n            timeout: 100000,\n            withCredentials: this._options.withCredentials,\n        };\n        if (transferFormat === TransferFormat.Binary) {\n            pollOptions.responseType = \"arraybuffer\";\n        }\n        // Make initial long polling request\n        // Server uses first long polling request to finish initializing connection and it returns without data\n        const pollUrl = `${url}&_=${Date.now()}`;\n        this._logger.log(LogLevel.Trace, `(LongPolling transport) polling: ${pollUrl}.`);\n        const response = await this._httpClient.get(pollUrl, pollOptions);\n        if (response.statusCode !== 200) {","sourceCodeStart":2243,"sourceCodeEnd":2279,"githubUrl":"https://github.com/OrchardCMS/OrchardCore/blob/4306c0717fe573f6fca1b4955909ddab6a192807/src/OrchardCore.Modules/OrchardCore.SignalR/wwwroot/Scripts/signalr.js#L2243-L2279","documentation":"LongPollingTransport.connect throws this when TransferFormat.Binary is requested but the environment's XMLHttpRequest does not expose a string-typed responseType property, meaning it cannot deliver binary arraybuffer responses. Older browsers and some embedded/polyfilled XHR implementations lack the advanced XHR features SignalR requires for binary long polling.","triggerScenarios":"Calling withUrl(...).configureLogging(...).build() and start(TransferFormat.Binary) — or using a HubConnectionBuilder configured for binary protocols (e.g. MessagePack hub protocol) — in an environment whose XMLHttpRequest lacks responseType support; also occurs when a custom/polyfilled XHR is injected.","commonSituations":"Legacy browsers (old IE/Android WebViews) running a MessagePack-based hub; Node polyfills of XMLHttpRequest that do not implement responseType; restricted environments (some kiosk/embedded browsers) where XHR is shimmed.","solutions":["Use the default JSON hub protocol and TransferFormat.Text instead of Binary/MessagePack.","Target a modern browser that supports XHR responseType (any evergreen browser).","Remove or replace the XHR polyfill with a spec-compliant implementation.","If in Node, use the native Node fetch/http path of @microsoft/signalr rather than a browser XHR shim."],"exampleFix":"// before\nconst connection = new signalR.HubConnectionBuilder()\n  .withUrl(\"/hub\")\n  .withHubProtocol(new signalR.protocols.msgpack.MessagePackHubProtocol())\n  .build();\nawait connection.start(signalR.TransferFormat.Binary);\n// after\nconst connection = new signalR.HubConnectionBuilder()\n  .withUrl(\"/hub\")\n  .build(); // JSON protocol, Text transfer format — works everywhere\nawait connection.start();","handlingStrategy":"fallback","validationCode":"function supportsBinaryXhr() {\n  if (typeof XMLHttpRequest === \"undefined\") return false;\n  return typeof new XMLHttpRequest().responseType === \"string\";\n}\nconst useMessagePack = supportsBinaryXhr();","typeGuard":"function hasAdvancedXhr() {\n  return typeof XMLHttpRequest !== \"undefined\" &&\n         typeof new XMLHttpRequest().responseType === \"string\";\n}","tryCatchPattern":"try {\n  await connection.start(signalR.TransferFormat.Binary);\n} catch (err) {\n  if (err.message.includes(\"Binary protocols over XmlHttpRequest\")) {\n    await rebuildConnectionWithJsonProtocol();\n  } else { throw err; }\n}","preventionTips":["Gate MessagePack/binary protocol usage on a runtime capability check.","Keep JSON protocol as the baseline; opt into binary only where supported.","Test on your oldest supported browser/WebView before shipping binary transport.","Avoid third-party XHR polyfills in apps using SignalR long polling."],"tags":["signalr","browser-compatibility","binary-protocol","long-polling"],"backgroundTag":"unsupported-operation","analyzedSha":"4306c0717fe573f6fca1b4955909ddab6a192807","analyzedAt":"2026-09-13T17:41:05.024Z","contentChangedAt":"2026-09-13T17:41:05.024Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}