Git Product home page Git Product logo

Comments (5)

RedGuy12 avatar RedGuy12 commented on September 24, 2024 2

Related to #10042

export function shouldUseGlobalFetchAndWebSocket() {
// Browser env and deno when ran directly
if (typeof globalThis.process === 'undefined') {
return 'fetch' in globalThis && 'WebSocket' in globalThis;
}
if ('versions' in globalThis.process) {
return 'deno' in globalThis.process.versions || 'bun' in globalThis.process.versions;
}
return false;
}

from discord.js.

RedGuy12 avatar RedGuy12 commented on September 24, 2024 1

Don't think so, it looks like the code still needs to be updated to support native WebSockets on Node, that PR focused on Deno and Bun support

from discord.js.

JMTK avatar JMTK commented on September 24, 2024

Oh nice! I didn't know about that one. Is it worth closing this issue then?

from discord.js.

KhafraDev avatar KhafraDev commented on September 24, 2024

ws is faster

from discord.js.

vladfrangu avatar vladfrangu commented on September 24, 2024

This is something I'll tackle sometime in the future. As it stands, the global ws is still experimental, and not as battle tested as ws (the npm package).

Maybe after we see the Autobahn tests results for it, as well as some performance comparisons, we can add it in as the defacto implementation used for newer node versions.

As it stands tho, if you really wanna try it out, you can fake that you're in bun/deno by setting that property in globalThis.process.versions property but you're on your own from then on (with that said I'd still love to hear if/what breaks when using node's global ws implementation, so poke me on discord @vladdy in a thread in the discord server)

from discord.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.