oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.53k stars 2.71k forks source link

Advanced `dgram` methods #10381

Open gvilums opened 5 months ago

gvilums commented 5 months ago

Tracking issue for the implementation of advanced dgram apis which are not going to ship in the initial version.

jebarpg commented 5 months ago

When will this issue be tackled?

Jarred-Sumner commented 5 months ago

When will this issue be tackled?

What do you use these APIs for?

For prioritization, it's helpful to understand the intended usecases and what packages/libraries or companies it's blocking. It seemed like the biggest usecase for dgram previously was dd-trace and possibly Discord voice chat APIs.

Letrab commented 5 months ago

When will this issue be tackled?

What do you use these APIs for?

For prioritization, it's helpful to understand the intended usecases and what packages/libraries or companies it's blocking. It seemed like the biggest usecase for dgram previously was dd-trace and possibly Discord voice chat APIs.

Everything using multicast is affected, some examples on top of my mind:

While I understand that the plain UDP support was a priority, I don't think this may be forgotten easily 👍 . In my case it would be a huge addition! Thanks already for your work on this!

jedahan commented 5 months ago

setBroadcast (or just setting SO_BROADCAST) is useful for dns-sd/mDNS, which I use in a lot of my projects. Honestly, looking at one of the implementations, I think this could be pulled out to a new ticket and mark as 'good first contribution' or something like that. I'd be willing to tackle it as long as people were patient (history says no lol) in me implementing it in a like, 2-3 week time frame.

from https://github.com/libuv/libuv/blob/520eb622f012c4cc17410ba702f82aebdb93c518/src/unix/udp.c#L1176C1-L1186C2

int uv_udp_set_broadcast(uv_udp_t* handle, int on) {
  if (setsockopt(handle->io_watcher.fd,
                 SOL_SOCKET,
                 SO_BROADCAST,
                 &on,
                 sizeof(on))) {
    return UV__ERR(errno);
  }

  return 0;
}
recanman commented 5 months ago

I've been wanting to use this library to retrieve metrics from collectd. It uses addMembership.

espired commented 4 months ago

Using both Bonjour and custom code with dgram . Mainly for service discovery

loicnestler commented 4 months ago

setBroadcast is used by cote.js (a microservice framework that relies on broadcasting)

kran6a commented 3 months ago

setMulticastTTL brought me here. It is used by bonjour-service, which I use for service discovery.

jedahan commented 3 months ago

setBroadcast (or just setting SO_BROADCAST) is useful for dns-sd/mDNS, which I use in a lot of my projects. Honestly, looking at one of the implementations, I think this could be pulled out to a new ticket and mark as 'good first contribution' or something like that. I'd be willing to tackle it as long as people were patient (history says no lol) in me implementing it in a like, 2-3 week time frame.

from https://github.com/libuv/libuv/blob/520eb622f012c4cc17410ba702f82aebdb93c518/src/unix/udp.c#L1176C1-L1186C2

int uv_udp_set_broadcast(uv_udp_t* handle, int on) {
  if (setsockopt(handle->io_watcher.fd,
                 SOL_SOCKET,
                 SO_BROADCAST,
                 &on,
                 sizeof(on))) {
    return UV__ERR(errno);
  }

  return 0;
}

Started getting the dev environment up today and writing failing test cases. Mentioning it in case someone else has already started work on it so I am not stepping on any toes.

rgillan commented 1 month ago

Hi, just ran into this one failing with setBroadcast, being called by matter-node.js, which relies upon mDNS for device discovery.

Letrab commented 1 week ago

Any update or progress on this by any chance @jedahan ?