socketio / engine.io-client

The engine used in the Socket.IO JavaScript client, which manages the low-level transports such as HTTP long-polling, WebSocket and WebTransport.

Home Page:https://socket.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use native whatwg instead?

jimmywarting opened this issue · comments

const parseuri = require("parseuri");
const parseqs = require("parseqs");

How about replacing this two with just URL & URLSearchParams?

That's a good remark, thanks! I think we would need to provide a polyfill for some browsers though:

Which makes this change less appealing. What do you think?

Related: #674

At least if they are available natively the polyfill would be GC'ed and wouldn't need to do a much JIT parsing

  • Possible to conditionally import?
  • Let developer decide if they wish to use a polyfill or not. Some are already dropping support for IE entirely, even microsoft themselves.
// README.md example

// Required for IE 11 support
globalThis.URL = globalThis.URL || require('url').URL
globalThis.URLSearchParams = globalThis.URLSearchParams || require('url').URLSearchParams

const engine = require('engine.io-client')

ppl could also use core-js or polyfill.io

i guess core-js is based on some browser usage config or something like that