Open ThePatrykOOO opened 1 year ago
@ThePatrykOOO Could you attach the log? How about another sample?
I researched the problem and the situation is very strange because the Unity application first receives a signal of the "disconnect" type, which sends the same info further to the connected client. This one, upon receiving this, immediately disconnects and the message follows: [POLITE] iceConnectionState changed:disconnected I checked the place where the received signal is read and I commented the line that passes the information to other places:
`//WebSocketSignaling.cs file
else if (routedMessage.type == "disconnect")
{
msg = JsonUtility.FromJson
//This is my code to see when exactly I am getting this signal to compare with the frontend
string timestamp = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture);
Debug.LogError($"OnDestroyConnection called: {timestamp}");
//This line of code I commented
//m_mainThreadContext.Post(d => OnDestroyConnection?.Invoke(this, msg.connectionId), null);
}`
The sent signal looks like this:
Signaling: Receiving message: {"type":"disconnect","connectionId":"505ecf2b-51d6-45d0-8164-857bc75f793e"}
After commenting this code, the problem was fixed (but in an ugly way):
m_mainThreadContext.Post(d => OnDestroyConnection?.Invoke(this, msg.connectionId), null);
Of course, the unity application still receives a signal after a minute from the last received message that it is time to disconnect, but this signal does not go any further, so the connection does not break and the client can continue to use the application without refreshing the page. But the problem is very weird
Additionally I send you logs from my web console:
[POLITE] SRD(answer)
logger.js:20 [POLITE] iceConnectionState changed:checking
logger.js:20 [POLITE] signalingState changed:stable
logger.js:20 On got Answer on 5442dd14-5c2c-47c5-8a38-e85d06149d9e.
[POLITE] iceConnectionState changed:connected
...
[POLITE] SRD(offer)
logger.js:20 [POLITE] signalingState changed:have-remote-offer
logger.js:20 [POLITE] ontrack:[object RTCTrackEvent]
logger.js:20 [POLITE] SLD to get back to stable
logger.js:20 [POLITE] signalingState changed:stable
....
[POLITE] iceConnectionState changed:disconnected
Futher I noticed that the bugs appear on remote setup. UnityApp - remote Node - remote Frontend App - remote. I lost connection after 60 seconds.
When I setup all localy this bug doesn't appear.
@ThePatrykOOO It sounds strange. Does the browser send the "disconnect" message?
It would be possible that the iceConnectionState
could change the state when the network status is changed. We need more time to check the behaviour.
https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/iceConnectionState
memo: URS-557
Package version
3.1.0-exp.4
Environment
Steps To Reproduce
Current Behavior
I don't see web streaming from unity app.
Expected Behavior
I should be connected with stream until when I close the connection or close the Unity App.
Anything else?
No response