Can I receive data from UDP port using websockets

Hi,

I want to receive data from UDP port using web socket, there will different channels for different type of data.

Is it possible in pheonix ?

Websockets do not run over UDP, so this is not possible with any library anywhere. If you wan to use UDP, you’ll have to use some other protocol, on both ends.

1 Like

ok thanks, What’s the possible option in elixir to receive data from UDP port, and whenever the browse send request for the data, that data should appear on front end.

:wave:

Browser might only send the data via UDP if you use webrtc, but there is no library in elixir right now that implements webrtc on the server, but you might make some use of dtls, I tried last year to make it work, but quickly failed, and switched to using janus instead.

Receiving UDP packets from, for example, an ios app works very nicely with elixir, you can use gen_udp for it.

2 Likes

Read UDP using Elixir, send it to the server however you want. I’m not trying to be dismissive, it’s just that once you receive data at the server, it’s just data, like data from any other event source (TCP, database listener, whatever), and whether you use long polling, or SSE, or websockets, is up to you–and the factors driving that decision would be the toolset you want to use for the web client side, the browsers and versions you need to support.

1 Like