Hello everyone!
I have trouble getting a connection between my Linux server and the corresponding corresponding WebGL client (both build with Unity with the WebRTC package).
The exchange of offer and answer works fine, I see they are created and set in the respective logs. The server creates a DataChannel and adds the OnOpen, OnClose, and OnMessage event handlers accordingly (they only log the event, and do nothing else).
On the client side RTCPeerConnection, I made sure to add anOnDataChannel event handler.
(More detailed information is in the spoiler tags. If anything is missing, that could help analyse the problem, please tell me. I will try to provide the information as quickly as I can.)
Connection process
-
Client sends request for new connection to server (via HTTP)
-
Server creates RTCPeerConnection, and
-
Adds OnIceCandidate and OnIceConnectionChange listeners
-
Creates a DataChannel and adds OnOpen, OnClose and OnMessage listeners to it
-
Creates an Offer
-
Sets the Offer as the local description
-
Server sends the SDP of its connections local description to the client
-
Client create RTCPeerConnection, and
-
Adds OnIceCandidate and OnIceConnectionChange listeners
-
Adds OnDataChannel listener
-
Sets the received SDP as the remote connection
-
Creates an Answer
-
Sets the Answer as the local description
-
Client sends the SDP of its connections local description to the server
-
Server sets the received SDP as its connections remote description
Offers and Answers
The created Offers and Answers look fine to me. The second ICE candidate in the offer is reachable from the WebGL client.
Offer:
v=0
o=- 5366312064322448853 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0
a=msid-semantic: WMS
m=application 7701 UDP/DTLS/SCTP webrtc-datachannel
c=IN IP4 SERVER.EXTERNAL.IP.ADDRESS
a=candidate:1876262918 1 udp 2122260223 SERVER.LOCAL.IP.ADDRESS 7701 typ host generation 0 network-id 1
a=candidate:2579888594 1 udp 1686052607 SERVER.EXTERNAL.IP.ADDRESS 7701 typ srflx raddr SERVER.LOCAL.IP.ADDRESS rport 7701 generation 0 network-id 1
a=candidate:559316214 1 tcp 1518280447 SERVER.LOCAL.IP.ADDRESS 7701 typ host tcptype passive generation 0 network-id 1
a=ice-ufrag:TqC1
a=ice-pwd:Hx7vnJSW9mmeSYP2IZqRy8i5
a=ice-options:trickle
a=fingerprint:sha-256 53:48:smile:A:18:BA:B3:7E:62:F5:E7:46:43:4B:CF:61:38:smile:8:B3:4B:E4:smile:6:02:39:88:82:FE:04:FB:smile:C:B8:6C:53
a=setup:actpass
a=mid:0
a=sctp-port:5000
a=max-message-size:262144
Answer:
v=0
o=mozilla...THIS_IS_SDPARTA-83.0 1159867020348037098 0 IN IP4 0.0.0.0
s=-
t=0 0
a=fingerprint:sha-256 63:9B:64:96:ED:82:AA:A8:35:AD:2B:72:C6:81:67:97:69:C6:56:92:1C:E6:88:89:41:06:4B:41:27:EA:E1:smile:5
a=group:BUNDLE 0
a=ice-options:trickle
a=msid-semantic:WMS *
m=application 9 UDP/DTLS/SCTP webrtc-datachannel
c=IN IP4 0.0.0.0
a=sendrecv
a=ice-pwd:f36d327bb2047e5d55b29bb6638d24e6
a=ice-ufrag:ced5a3cc
a=mid:0
a=setup:active
a=sctp-port:5000
a=max-message-size:1073741823
Unfortunatelly I never see in the server logs that the channel was opened, or in the client logs, that it was received.
I do see in the server logs that the RTCIceConnectionState changes to Checking, but no further changes after that. Although the offer from the server contains a candidate that should work.
I would really appreciate any thoughts, and tipps to find the cause that the RTCPeerConnections don’t really connect.
Thanks in advance and best regards,
Patrick