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.

Qqwy

Qqwy

TypeCheck Core Team

It may be worth noting that DTLS-support now is in beta in OTP20.

Where Next?

Popular in Questions Top

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
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
logicmason
Hi there, I'm working through my first release with elixir/phoenix. I've built a release with distillery and found that it crashes when I...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
mathew4509
I have a list say x = ["23gh", "56kh", "97mh"] I would like to pass each element to Val in each iteration. Say, in iteration 1 -------...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
kostonstyle
Hi all I want to have a unix time, from the current time plus 1 hour. DateTime.now + 1 hour How to get it in elixir? Thanks
New

Other popular topics Top

lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30048 115
New
yurko
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
polypush135
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New

We're in Beta

About us Mission Statement