Open Juraj-Masiar opened 5 months ago
We could indeed provide another implementation for the HTTP long-polling transport, something like:
import { io } from "socket.io-client";
const socket = io({
transports: [
PollingWithFetch,
WebSocket
]
});
Related: https://github.com/socketio/engine.io-client/issues/716
Is your feature request related to a problem? Please describe. Currently, socket.io can't be used in Chrome extension background script, since modern Manifest V3 extensions are using service worker as a background script (which doesn't have
XMLHttpRequest
, onlyfetch
). Example error:Describe the solution you'd like Replacing
XMLHttpRequest
with modernfetch
.Describe alternatives you've considered I think using
transports: ['websocket'],
would help, but that way I can't useextraHeaders
which I use for authorization.Additional context