-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send SDP answer without signalling server #1615
Comments
No, it doesn't work that way. People have speculated about the possibility of including the necessary information in the ICE handshake, but so far, nobody (as far as I know) has published a working example of this approach, or undertaken the necessary work of standardization that would be needed to make it part of the official WebRTC spec. |
@alvestrand thank you. Could please clatify: Imagin text chat app. Users can connect to chat by link. Thus: every user must have alive socket connection with Signling Server. Socket connection must be alive all time user in chat. |
That's a completely different question.
Yes, if you want the signaling server to be able to send information about
new users, the clients must have a connection open to the signaling server.
(This connection can be a WebRTC connection if you want it to be.)
WebRTC permits, but does not require, direct media and datachannel
connections between the participants.
…On Mon, Aug 14, 2023 at 7:51 AM Alexey Boyko ***@***.***> wrote:
@alvestrand <https://github.com/alvestrand> thank you. Could please
clatify:
Imagin text chat app. Users can connect to chat by link.
To send messages to all users every user must have Peer2Peer WebRTC
connection with all users. It is many-to-many.
When new user connect to chat, all current users must receive the new
user's SDP. The only way current users can get new user's SDP is by using
Signling Server.
Thus: every user must have alive socket connection with Signling Server.
Socket connection must be alive all time user in chat.
If all users have full time alive socket connection - what's the benefit
of WebRTC ?
—
Reply to this email directly, view it on GitHub
<#1615 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADVM7JPLG4OCM6EQOG47RLXVG4F5ANCNFSM6AAAAAA3O3FV7M>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
The answer is simple: for that use-case WebRTC offers little benefit. Those come when you add requirements like file transfer and voice/video chat which the signaling/chat server can't handle for capacity reasons. |
@alvestrand @fippo thank you. I know my questions is not an issue report. But it is the only place where I can get answers. Code below exchange only SDP between peers. It does not send ICE candidates. And its working,
Signaling server mock const signaling = {
/** @param {string} senderId, @param {RTCSessionDescription} sdp */
sdpAndIceChannelsSend: (senderId, sdp) => {
console.log(`${senderId} SDP send`);
document.dispatchEvent(new CustomEvent('sdp', {detail: { senderId, sdp } }));
},
/** @param {string} clientId, @param {(sdp:RTCSessionDescription)=>void} callBack */
sdpAndIceChannelsOnGet: (clientId, callBack) =>
document.addEventListener('sdp', evt => {
if (evt.detail.senderId !== clientId) {
console.log(`${clientId} SDP onGet`);
callBack(evt.detail.sdp);
}
}),
}; code: //
// remote peer
{
const remoteClientId = 'REMOTE';
const remoteCon = new RTCPeerConnection();
remoteCon.ondatachannel = evt => {
console.log('REMOTE ondatachannel');
const channel = evt.channel;
channel.onopen = (event) => {
console.log('REMOTE channel onopen');
// send message to LOCAL
const msg = 'Hi from remote';
console.log(`REMOTE message send: ${msg}`);
channel.send(msg);
};
channel.onmessage = (event) => {
console.log('REMOTE onmessage:', event.data);
};
};
signaling.sdpAndIceChannelsOnGet(remoteClientId, async (sdpOffer, iceCandidates) => {
await remoteCon.setRemoteDescription(sdpOffer);
await remoteCon.setLocalDescription();
signaling.sdpAndIceChannelsSend(remoteClientId, remoteCon.localDescription);
});
}
//
// local peer
{
const localClientId = 'LOCAL';
const localCon = new RTCPeerConnection();
const localChannel = localCon.createDataChannel('chat');
localChannel.onopen = evt => {
console.log('LOCAL channel onopen');
// send message to REMOTE
const msg = 'Hi from local';
console.log(`LOCAL message send: ${msg}`);
localChannel.send(msg);
};
localChannel.onmessage = evt =>
console.log('LOCAL onmessage:', evt.data);
// SDP
// creates and sets SDP
await localCon.setLocalDescription();
signaling.sdpAndIceChannelsOnGet(localClientId, async sdpAnswer =>
await localCon.setRemoteDescription(sdpAnswer));
localCon.onicecandidate = evt => {
if (!evt.candidate) {
// all ice candidates getted
signaling.sdpAndIceChannelsSend(localClientId, localCon.localDescription);
}
};
} Console ouput:
Why this code work if ICEs don't exchange? |
Please read first!
Please use discuss-webrtc for general technical discussions and questions.
If you have found an issue/bug with the native
libwebrtc
SDK or a browser's behaviour around WebRTC please create an issue in the relevant bug tracker. You can find more information on how to submit a bug and do so in the right place hereNote: If the checkboxes above are not checked (which you do after the issue is posted), the issue will be closed.
Browser affected
Version 115.0.5790.171 (Official Build) (64-bit)
Description
Is it possible to send SDP answer over RTCPeerConnection without signaling server?
Exmaple 2 shows what I am asking for.
Steps to reproduce
Example 1. WebRTC communication, when SDP answer send over signaling server.
It is mock signaling server:
Here is working code
Console ouput:
Example 2. WebRTC communication, when SDP answer send over WebRTC
What I am asking for.
As I understand:
LOCAL peer can create SDP, collect all ICE Candidates, and send all at once to REMOTE peer over Signaling Server. REMOTE peer know SDP offer and ICE Candidates -> can send SDP answer over WebRTC.
singnaling service:
Not working code
Console ouput:
Expected results
Example of WebRTC connection setup without sendind SDP aswer over signaling server.
Actual results
Can't setup WebRTC connection without sendind SDP aswer over signaling server.
The text was updated successfully, but these errors were encountered: