Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement dgram #1630

Closed
Jarred-Sumner opened this issue Dec 19, 2022 · 103 comments · Fixed by #7271
Closed

Implement dgram #1630

Jarred-Sumner opened this issue Dec 19, 2022 · 103 comments · Fixed by #7271
Labels
node.js Compatibility with Node.js APIs tracking An umbrella issue for tracking big features

Comments

@Jarred-Sumner
Copy link
Collaborator

No description provided.

@Jarred-Sumner Jarred-Sumner added tracking An umbrella issue for tracking big features node.js Compatibility with Node.js APIs labels Dec 19, 2022
@JL102
Copy link
Contributor

JL102 commented May 17, 2023

Yes please! I'm working on an open source UPnP server package which uses dgram for some of its connection backend. It would be great if we could take advantage of bun's much improved speed in sqlite3 and general code execution, but we can't yet until dgram is implemented.

@deadlinecode
Copy link

This would also be nice to have for using @discordjs/voice to stream audio (especially since ytdl-core is working now)

@ezShroom
Copy link

@Jarred-Sumner How's this going?

@pcfreak30
Copy link

Just tested some of my code again on bun 0.7.4 and this is needed.

Kudos.

@daviddutch
Copy link

I've just tried on Bun 0.8 without any luck:
NotImplementedError: node:dgram createSocket is not yet implemented in Bun.

This seems to be the blocker for one of our app.

@joetifa2003
Copy link

This would be awesome for discord/voice, waiting for this!

@meluiz
Copy link

meluiz commented Aug 29, 2023

This would be awesome for discord/voice, waiting for this!

Yes. I'm have some difficult to use discord/voice or discord-player.

@hpx7
Copy link

hpx7 commented Sep 8, 2023

I tried Bun 1.0 but it looks like our https://www.npmjs.com/package/hot-shots dependency doesn't work due to lack of node:dgram support

@jedahan
Copy link

jedahan commented Sep 8, 2023

Well maybe we can start the discussion of whats needed to implement.

Cursory look at the node docs for dgram shows 1 type (Socket) with 19 methods, 5 events, and 2 constructors.

@onionhammer
Copy link

node-ssdp relies on dgram

@billdybas
Copy link

dd-trace (Datadog APM) also relies on dgram

https://github.com/DataDog/dd-trace-js/blob/8cf126c82cdeccb54ae119249c7905ab06a05d94/packages/dd-trace/src/dogstatsd.js#L5

@Zibri
Copy link

Zibri commented Sep 9, 2023

also bittorrent-dht relies on dgram.
:(
this should be prioritized.

@coffeeispower
Copy link
Contributor

discord voice protocol uses UDP, @discordjs/voice uses dgram, this should be done ASAP (after bug fixes)

@Saissaken
Copy link

I reviewed #159, but it seems like this is not on the roadmap, is it? @Jarred-Sumner

@rcarmo
Copy link

rcarmo commented Sep 10, 2023

Came here looking for this since it's a blocking issue for doing all sorts of IoT stuff.

@MrDanielHarka
Copy link

I would really need it for Webtorrent. 🙏

@kalanchoej
Copy link

Bun can't be a drop-in replacement for really any of my projects without dgram support since we use dd-trace and hot-shots.

@Reusek
Copy link

Reusek commented Sep 11, 2023

Does anyone working on this? I could try implement something...

@rcarmo
Copy link

rcarmo commented Sep 11, 2023

A quick note: UDP support also implies multicast ;)

@oliverlevay
Copy link

this library that I want to use https://github.com/alxhotel/chromecast-api needs this

@Marcos-Rollon
Copy link

A lot of us working with IoT and robotics really need this. I hope it gets prioritized, since is not on the roadmap (as in #159 )

@alessandroamella
Copy link

Up! Really need this for Bonjour (mDNS)

@LIMPIX31
Copy link

Looking forward to the datagram.

@BlusteryS
Copy link

Up

@nahuelon
Copy link

It would be great for IoT ad-hoc servers listening for UDP messages. Thanks.

@LIMPIX31
Copy link

As a temporary solution, this can be implemented via FFI

@volschin
Copy link

@jadbox it‘s not a bug, simply not implemented as described in the documentation.

@rob-raisch-simplisafe
Copy link

Um. It seems to me that "not implemented as described in the documentation" would require either fixing the module so it does what the documentation describes or the documentation needs to be changed so it reflects the correct operation of the module. So, yes, I'd say it's a bug. :)

@fitzn
Copy link

fitzn commented Mar 28, 2024

@rob-raisch-simplisafe UDP is not in the documentation, so there is no bug or error in the documentation. It is not listed as something that is supported. This issue tracks support for UDP. As @jedahan said, you are welcome to pick up where #7271 left off, or start from scratch. And, of course, if you see an error in the documentation, please open a pull request.

@rob-raisch-simplisafe
Copy link

Thanks for the clarification.

@volschin
Copy link

@rob-raisch-simplisafe The documentation I have written about, is this one:
https://bun.sh/docs/runtime/nodejs-apis

@recanman
Copy link

I'm willing to set a bounty, paid in XMR, for someone that can get a PR merged as soon as possible.
This is a critical issue.

@pcfreak30
Copy link

I'm willing to set a bounty, paid in XMR, for someone that can get a PR merged as soon as possible. This is a critical issue.

👀 crypto has entered the house! 🙃.

@dathacky
Copy link

dathacky commented Apr 9, 2024

+1

@Bytedefined
Copy link

Would be great to see support for this, along with node:cluster.

@xenyal
Copy link

xenyal commented Apr 9, 2024

Being unable to use dd-trace blocks apps using Datadog APM in production. Is prometheus the only monitoring tool people use to monitor bun apps?

@sharathprabhal
Copy link

Is the core team working on this @Jarred-Sumner

Also, is anyone in the community actively working on this? Happy to take a stab otherwise.

@evsar3
Copy link

evsar3 commented Apr 12, 2024

Despite of the excellent job being done by the Bun team, this feature should be top priority by now. This "bun shell" thing should have take a lot of effort to accomplish and at least for me, I don't see it being more critical for server-side software development than one of the most important network protocols in the world.

Maybe I'm too dumb to see the real potential of bun shell, but IMO bun should focus on features that would really bring the community into Bun.

@recanman
Copy link

recanman commented Apr 13, 2024

@sharathprabhal I don't believe that anyone is working on it currently. If you (or anyone else) can successfully get a PR merged, I will pay some XMR.

@gvilums
Copy link
Contributor

gvilums commented Apr 15, 2024

@recanman I'm working on this right now

@sharathprabhal
Copy link

@recanman I'm working on this right now

❤️
@gvilums do you have release timeline?

@renejfc
Copy link

renejfc commented Apr 15, 2024

@recanman I'm working on this right now

Much appreciated! 🙏 the community will love this

@Zibri
Copy link

Zibri commented Apr 17, 2024

@recanman I'm working on this right now

❤️ @gvilums do you have release timeline?

About time!
(I'm joking.... thanks!!!)

@FDiskas
Copy link

FDiskas commented Apr 26, 2024

A good test case would be this simple example:

import util from 'node:util';
import nslookup from 'nslookup';

const debuglog = util.debuglog('test');
const domain = 'example.com';

debuglog('Looking up', domain);

nslookup(domain)
.server('208.67.222.123')
.type('a')
.timeout(10 * 1000)
.end(function(error, address) {
    debuglog('got ip', address[0], 'for', domain);
});

To test this

NODE_DEBUG=test bun test.js

It throws an error as currently expected:
image

@MrDanielHarka
Copy link

Why is it closed if it's not fixed, @gvilums?

$ bun upgrade
Bun v1.1.5 is out! You're on v1.1.3
[11.94s] Upgraded.

Welcome to Bun v1.1.5!

Report any bugs:

    https://github.com/oven-sh/bun/issues

What's new:

    https://github.com/oven-sh/bun/releases/tag/bun-v1.1.5

Changelog:

    https://github.com/oven-sh/bun/compare/bun-v1.1.3...bun-v1.1.5

~/code/harka-torrent
$ bun app.js 
14 |   warned.add(feature), console.warn(new NotImplementedError(feature, issue));
15 | }, $;
16 | 
17 | class NotImplementedError extends Error {
18 |   code;
19 |   constructor(feature, issue) {
                               ^
NotImplementedError: node:dgram createSocket is not yet implemented in Bun. Track the status & thumbs up the issue: https://github.com/oven-sh/bun/issues/1630
 code: "ERR_NOT_IMPLEMENTED"

      at new NotImplementedError (internal:shared:19:27)
      at internal:shared:2:69
      at node:dgram:2:55
      at createSocket (/Users/d.harka/.bun/install/cache/@silentbot1/nat-api@0.4.7/lib/upnp/ssdp.js:83:18)
      at /Users/d.harka/.bun/install/cache/@silentbot1/nat-api@0.4.7/lib/upnp/ssdp.js:41:9
      at forEach (:1:21)
      at createSockets (/Users/d.harka/.bun/install/cache/@silentbot1/nat-api@0.4.7/lib/upnp/ssdp.js:39:22)
      at new Ssdp (/Users/d.harka/.bun/install/cache/@silentbot1/nat-api@0.4.7/lib/upnp/ssdp.js:28:5)
      at new Client (/Users/d.harka/.bun/install/cache/@silentbot1/nat-api@0.4.7/lib/upnp/index.js:6:17)
      at new NatAPI (/Users/d.harka/.bun/install/cache/@silentbot1/nat-api@0.4.7/index.js:53:26)

@Bartel-C8
Copy link

Bartel-C8 commented Apr 27, 2024

Have a little patience... The merge only has been done 7hours ago...
As I can track, it will be included in the v1.1.6 release.

Thanks for your work on this @gvilums !

@MrDanielHarka
Copy link

Error 404: Patience not found!

Oh, shite! I thought it was included in v1.1.5.

@Jarred-Sumner
Copy link
Collaborator Author

This will be part of the Bun v1.1.6 release, which we are aiming to do later tonight

@LIMPIX31
Copy link

It's a win, folks! 🎉

@recanman
Copy link

@gvilums Thank you very much. If you'd like the bounty, please post an XMR address

@Letrab
Copy link

Letrab commented Apr 27, 2024

Everyone wanting to use dgram, be advised that multicast UDP is not implemented yet: #10381

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
node.js Compatibility with Node.js APIs tracking An umbrella issue for tracking big features
Projects
None yet
Development

Successfully merging a pull request may close this issue.