hubertlepicki

hubertlepicki

Elixir server for WebRTC data channels (or other UDP-like channels)

I am trying to build something using Phoenix channels, and as great as they are, I am hitting a wall with something.

Basically, I need to send data to server in “fire and forget” manner. I may also get occasional messages from the server. I am not interested in retries, failures, and correct order of arrival of my (or server’s) messages.

I need a UDP-like connection, and Phoenix channels are TCP-like.

I know WebRTC data channels can be put into “unreliable” mode. This looks like what I need precisely, and I tested it browser-to-browser, this will be alright.

But I failed to find any info on how can I integrate that with Elixir on the server. Any ideas?

It’s not a signaling server I need, but a server that would join WebRTC data channel in similar fashion as browsers do.

Most Liked

smpallen99

smpallen99

I’ve done a lot of voice WebRTC with elixir. Typically, the media path for WebRTC is from browser to browser, and the server is not included in the media path unless you need to have the server in the middle of the media path. Phoenix channels are great for the WebRTC signalling portion to setup the media path. I have not used data channels yet, but can’t imagine that they are much different than voice or video.

If you need to anchor the media path on the server, your going to have some difficulties with Elixir/Erlang. Current browsers require that the WebRTC media path use DTLS (TLS over UDP). The last time I checked (6 months ago), there was NO support for DTLS in erlang.

I have a simple Phoenix WebRTC demo project on github you may want to checkout.

Steve

sasajuric

sasajuric

Author of Elixir In Action

I’m not sure if using Phoenix for accepting UDP makes sense. Phoenix endpoint is powered by Cowboy, so TCP is always underneath. UDP is connectionless, so even if it can somehow be integrated directly into endpoint, I think it would be a needless complication.

If the system needs to handle UDP next to TCP traffic, I’d just start a separate process powered by gen_udp. I think it can even listen on the same port as the endpoint, as the networking protocols are different.

michalmuskala

michalmuskala

@hubertlepicki While it might be possible to do this with phoenix, it might not be the best idea - I forgot to add that to my response :smirk: So I fully agree with you here.

@sasajuric I don’t think the channel has to be started by the cowboy. The transport implementation controls this entirely.

Last Post!

alfredfriedrich

alfredfriedrich

Where Next?

Popular in Questions Top

New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

Other popular topics Top

Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement