Can I use Websocket as a client?

769 views
Skip to first unread message

Hasan Tekin

unread,
Sep 5, 2015, 7:17:31 AM9/5/15
to meetecho-janus
Hey,

I want to use Janus(on Raspberry Pi) as a WebRTC client. And for signalling I'm gonna use a web server. So, Janus needs to connect to web server via websocket. But as I can see so far, Janus uses websocket as server only.

Is there any implementation of websocket client in Janus or should I use libwebsocket library directly from my plugin?

Thank you for your hardwork and help.

Hasan

Lorenzo Miniero

unread,
Sep 5, 2015, 12:18:55 PM9/5/15
to meetecho-janus
Not sure what you mean by that. Janus is a server, not a client: it doesn't connect to anything, clients do.
The janus.js library has a way to use WebSockets from web pages.

L.

RoyN

unread,
Sep 5, 2015, 1:19:22 PM9/5/15
to meetecho-janus
I think what Hasan, is referring to is to use a webserver as a "client" to control Janus, is that the case?

We have implemented this using Node.js to make calls to Janus, both via HTTP REST as well as Websockets.  If this is the case I can ask someone to cleanup an example and post here...

Hasan Tekin

unread,
Sep 5, 2015, 1:40:41 PM9/5/15
to meetecho-janus

RoyN, Lorenzo thanks for your responses.


I draw a basic diagram for the setup I want. So, since Janus can do a webRTC connection and stream video and accept data, I want to use it as a webRTC peer. So, in this setup, these steps will be taken;


1) Raspberry Pi connects to Web Server via Websocket (using Janus or libwebsocket or something else).

2) Remote Pc connects to Web Server via Websocket using a browser (javascript).

3) Raspberry Pi(Janus) sends an webRTC offer over Websocket connection to Web Server.

4) Web Server relays that offer to the browser and do other signalling stuff.

5) Raspberry Pi(Janus) and Browser(javascript) connect to each other via WebRTC.

6) Raspi sends camera stream.

7) Browser sends commands over DataChannel.


That's it. I hope I'm clear enough. If not, please ask me for further explanation.


Now, I wanna ask that can I use Janus as a webRTC peer like this? And also can I use Websocket of Janus to connect to Web Server?


Thank you so much.


Hasan



5 Eylül 2015 Cumartesi 20:19:22 UTC+3 tarihinde RoyN yazdı:

Lorenzo Miniero

unread,
Sep 5, 2015, 1:50:49 PM9/5/15
to meetecho-janus
No, Janus only implements a WebSocket server, not a client. You'll have to do some manipulation at the application level to have it act as a regular peer.

L.

Hasan Tekin

unread,
Sep 5, 2015, 2:22:04 PM9/5/15
to meetecho-janus

So, I can write a plugin that behaves like a peer without touching any other file of Janus?


5 Eylül 2015 Cumartesi 20:50:49 UTC+3 tarihinde Lorenzo Miniero yazdı:

Lorenzo Miniero

unread,
Sep 7, 2015, 4:18:57 AM9/7/15
to meetecho-janus
It's not a matter of plugins: the WebSocket stack is part of the core. As I said, this is something you have to orchestrate at an application server level: the application must act as a "client" on Janus' behalf, and interact with Janus accordingly when calls have to be made.

L.

Hasan Tekin

unread,
Sep 7, 2015, 4:24:42 AM9/7/15
to meetecho-janus

Ok, I'll try my best to do that.

Thank you very much for your efforts. I hope I can also contribute to Janus somehow with what I'm gonna do.

Hasan

7 Eylül 2015 Pazartesi 11:18:57 UTC+3 tarihinde Lorenzo Miniero yazdı:

Lorenzo Miniero

unread,
Sep 7, 2015, 4:29:00 AM9/7/15
to meetecho-janus
You can find info on a similar effort here: https://github.com/meetecho/janus-gateway/issues/162

L.
Reply all
Reply to author
Forward
0 new messages