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
dokuzbir
Hello, I am trying to convert my lists to string without losing brackets.For start i have 3 map. They look like these buyer = %{ id: ...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
makeitrein
Hey all, just started picking up Elixir last week and am writing a scraper as a learning project. Baby step #1 is extracting the number ...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
chewm
Hi guys, nice to meet you to the whole forum, I’m new here, I’m trying to configure visual studio code for elixir, right now the intellis...
New
jc00ke
Expanding on this topic: https://forum.elixirforum.net/t/map-typespec-question/19217 Let’s say I have a map with required and optional k...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New

Other popular topics Top

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
Tee
can someone please explain to me how Enum.reduce works with maps
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 42633 214
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New

We're in Beta

About us Mission Statement