-
Notifications
You must be signed in to change notification settings - Fork 406
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
datachannel not working #1074
Comments
Did you try "WebRTCGetStartedDataChannel" example ? |
Hi, thank you for your answer. Yes, I took the code from there |
From what I've seen, the All my code is based on the WebRTC DataChannel 'Getting Started'. Thank you. |
A temporary workaround that works, but if you like living dangerously: pc.ondatachannel += (rdc) =>
{ // Put it here
rdc.onopen += () => logger.LogDebug($"Data channel {rdc.label} opened."); // Instead of here
rdc.onclose += () => logger.LogDebug($"Data channel {rdc.label} closed.");
rdc.onmessage += (datachan, type, data) =>
{
}
} |
I can confirm that |
hi @ris-work , would you mind sharing your code on sorrentino.mauro95@gmail.com ? to me also onmessage doesn't work and I don't understand why, I took the how to use code from their example. I didn't have much time this month to look into this though |
can you please tell me how you made the datachannel work? I successfully exchanged everything needed (offer and answer have m=datachannel) and the connection state of peer connection is connected. I am only creating 1 datachannel before the offer, rdc.readyState is open but I'm not able to send messages for some reasons. if I look at rdc.negotiated in ondatachannel the answerer tells me it's false, how do I make it pass to true? offer and answer have both nm=application 9 UDP/DTLS/SCTP webrtc-datachannel and the state of peer connection is connected (I even tested it by closing the connection to the server and make a brand new peer connection and when that happens the other client says peer connection state is disconnected)
peerConnection.ondatachannel += (rdc) =>
{
rdc.send("test");
Console.WriteLine($"dc state {rdc.readyState}"); // returns open
Console.WriteLine($"datac state {rdc.negotiated}"); // returns false
this.rdc = rdc;
rdc.onopen += () => Console.WriteLine($"Data channel {rdc.label} open."); // not working
rdc.onclose += () => Console.WriteLine($"Data channel {rdc.label} closed.");
// the following never fires
rdc.onmessage += (datachan, type, data) =>
{
Console.WriteLine($"type {type}");
string msg = Encoding.UTF8.GetString(data);
Console.WriteLine($"Data channel {datachan.label} message {type} received: {msg}.");
// Do a string echo.
rdc.send($"echo: {msg}");
};
};
return peerConnection;
The text was updated successfully, but these errors were encountered: