In the perfect world webRTC enable
peer to peer communication but in the real world webRTC still needs signaling
servers. Here I’m going to explain you why we need signaling servers and where
we need signaling servers.
What is Signaling?
Signaling is the exchange of
information between involved points in the network that sets up, controls, and
terminate each connections. its clients need to exchange some information such
as
- · Session control information
Determines
when to initialize, close, and modify communications sessions.
- · Network Data
Callers can
find callees endpoints.
- · Media Data
is required
to determine the codecs and media types that the callers and callees have in
common.
So
this signaling process needs a way for clients to pass messages back and forth.
Why signaling is not defined by
webRTC APIs?
To avoid redundancy and to maximize
compatibility with established technologies, signaling methods and protocols
are not specified in webRTC standards.
Why
we still need signaling servers in WebRTC?
In the perfect world signaling in
webRTC is straight forward and simple. Every WebRTC endpoints would have a
unique IP address that it could exchange with other peers in order to
communicate directly. JSEP (JavaScript Session Establishment Protocol) gives a summary
of this approach. But that document is lengthy and somewhat involved. Here is a
simple and straightforward explanation that will provide you with enough
information to be known.
The mechanism to establish a
connection between two parties (Let’s say Alice and Bob).
1.
Alice creates an offer that
contains his local SDP.
2.
Alice attaches that offer to
something known as an RTCPeerConnection object.
3.
Alice sends his offer to the
signaling server using WebSocket. WebSocket is a protocol that
provides a full-duplex communications channel over a network connection. WebRTC
standardized on WebSocket as the way to send information from a web browser to
the signaling server and vice versa.
4.
Bob receives Alice’s offer using
WebSocket.
5.
Bob creates an answer containing
his local SDP.
6.
Bob attaches his answer, along with
Alice’s offer, to Alice's own RTCPeerConnection object.
7.
Bob returns his answer to the
signaling server using WebSocket.
8.
Alice receives Bobs’s offer using
WebSocket.
Keeping it Simple
This should be enough for now to
convey the following points.
·
WebRTC does not define signaling.
·
JSEP summarized signaling approach
in webRTC.
·
A signaling server sits between two
clients.
·
Clients use WebSocket to communicate
to a signaling server and vice versa.
No comments:
Post a Comment