Globik / kore.io_websocket

Websocket webRTC signaling protocol based on Kore.io framework written in C
10 stars 6 forks source link

Examples rtcdc/t.c and rtcdc/d.c are very slow #1

Open ClosetGeek-Git opened 6 years ago

ClosetGeek-Git commented 6 years ago

I tried the examples rtcdc/t.c and rtcdc/d.c and they were very slow. rtcdc/t.c seems to be a basic echo application but it takes around 30-60 seconds to negotiate connection and around 10-30 seconds for each message. I am using Ubuntu 18, and have tried it over multiple connections (my personal ethernet and wifi, tethered to a Verizon Mobile device, and a local wifi hotspot). The results are always the same. I was wondering if this is normal?

ClosetGeek-Git commented 6 years ago

Also my personal internet connection isn't hampered with NAT issues

Globik commented 6 years ago

This is not normal. I have the same experience with the rtcdc lib. https://github.com/xhs/librtcdc/blob/master/src/rtcdc.c It was maintenaiter's proof of concept, a binding to python. Without AsyncQueue messages between threads. The Lorenzo's Janus webrtc decision based on glib ecosystem is much faster. On my side here I'v just maked a little experiment with lib rtcdc and kore framework. If I could integrate some stuff directly to the framework. This adventure was positive for me, but not for a "production" step.

ClosetGeek-Git commented 6 years ago

I'm curious to how this could be. I can see poor design making a difference in the level of a few dozen ms but full 10+ second delays?

Globik commented 6 years ago

It's my fault. There could have a place a mistake or so in my code. I'm a newcomer in a C world. Besides yeah it's a basic echo app with two server side peers in two event loop instances. It's a nonsense of me, that uses two loops. It's a bad practice. There must be only one event loop at a time running. Two loops are only disordering each other. So it is very slow and messed up.

Globik commented 6 years ago

Yet another webrtc datachannel experiment https://github.com/Globik/kore.io_websocket/tree/master/websocket_10 Integrated janus webrtc gateway core api into the kore webframework. Much faster between browser and server. I have forgotten which version of Janus I've used. But the idea is clear enough I think. Build a shared lib from janus, write some wrappers and bind to a custom websocket. Can be bound to any server side programming language.

ClosetGeek-Git commented 6 years ago

@Globik Looking through the code on t.c I don't think it's your fault. Since you brought up the issue of your work I'll go far enough to say that you need to work some on indentation but your code seems solid. 10+ second delays shouldn't happen without a hard sleep() call so it's on the librtcdc end or my end. Thanks!

ClosetGeek-Git commented 6 years ago

I looked into your websocket_10 and it looks good - I think I will try that route. What is your experience with janus' WebRTC?

Globik commented 6 years ago

Not so much of experiences with janus gateway. Plugin echotest.c. Just wanted to integrate the janus core api into any good webframework written in C. Yes, it's a real thing. You can write custom plugins and integrate further to webserver using janus core api, but not using his transport layer plugins. As any webframework is self a transport like kore framework. The only thing is that it is very complicated to hack janus core api. Some creative work it is, to write custom wrappers around janus api. Besides janus 's source code is changing very quickly, need to change also those wrappers around api so or so. But it worths it. Perfomance benefit over nodejs and the like is evidently. I don't say about 500 and more users at a time. There are projects in the world where less than 500 users of webrtc are enough for small buisness cases, - for webinars, consalting, or live video streaming from 5 to 6 IP-cameras at a time around o'clockly.