jitsi / jitsi-videobridge

Jitsi Videobridge is a WebRTC compatible video router or SFU that lets build highly scalable video conferencing infrastructure (i.e., up to hundreds of conferences per server).
https://jitsi.org/jitsi-videobridge
Apache License 2.0
2.91k stars 989 forks source link

Please clarify the need and usage of WebSockets (/colibri-ws/) #610

Open vi opened 6 years ago

vi commented 6 years ago

https://github.com/jitsi/jitsi-videobridge/blob/master/doc/rest.md

A WebSocket API for communication with conference endpoints (/colibri-ws/)

Where can I find the API documentation of what can be sent to and received from this websocket?
How does this interact with the usual REST interface (/colibri/)?

bgrozev commented 6 years ago

This is independent from the /colibri/ interface. It is meant for clients to use instead of WebRTC data channels (the main motivation being the lack of data channel support in Edge). It is implemented as just another transport for the same messages that are supported over the data channel (i.e. last-n notifications, selecting endpoints, endpoint-to-endpoint messages).

vi commented 6 years ago

And is the data channel usage itself documented somewhere? (datachannel-communication.md is short-esque and with no actual session examples)

Can this (or data channels or something else) be used to monitor such events from infrastructure signaling server, not from a peer? Or should a dummy peer just for monitoring events be used for this? Like a private API version of WebSocket interface.

bgrozev commented 6 years ago

And is the data channel usage itself documented somewhere?

Unfortunately not. There's fragments here

Can this (or data channels or something else) be used to monitor such events from infrastructure signaling server, not from a peer? Or should a dummy peer just for monitoring events be used for this?

The web sockets are only available for Endpoints in a conference. You could create a dummy endpoint through colibri.

vi commented 6 years ago

Thanks for the explanation.

What is the best way of maintaining a dummy peer just for receiving events?
Can it be established using REST-Colibri+WebSocket alone (without any WebRTC video, audio or data channel)? Will connected WebSocket keep that dummy peer from expiring?

bgrozev commented 6 years ago

What is the best way of maintaining a dummy peer just for receiving events? Can it be established using REST-Colibri+WebSocket alone (without any WebRTC video, audio or data channel)? Will connected WebSocket keep that dummy peer from expiring?

I'm not sure if and Endpoint without any channels will work. You might need to create a dummy channel for it. The WebSocket should keep it alive, but we haven't used it in this way, so you might run into some issues.

vi commented 6 years ago

Is there some sane way (apart from {a dummy peer} or {continual polling of REST API with GETs} or {using XMPP instead of REST}) to know when channel/peer appears (client starts sending media packets) and disappears (times out)?

bgrozev commented 6 years ago

We have an Event API in jitsi-videobridge/jicoco, which is used when various conditions occur (when a channel is created/expired among others). Currently, the event consumers (implementations of EventHandler) are internal to our projects only (we used to have one which logged to an influxdb database, but the implementation was bad and we removed it).

You could write your own EventHandler, but you would have to build your own version of jitsi-videobridge. You could also write a generic EventHandler which sends out the events via HTTP to a pre-configured endpoint. I think this is something we can accept into jicoco.