Firefox and webrtc - problem with web socket??

Hello,

I’m following WOWZA sample code for WEBRTC integration (https://www.wowza.com/docs/how-to-use-webrtc-with-wowza-streaming-engine). And all works great, but Firefox has some problem.

So, I have this code which connects to wowza streal lock url. But problem is that firefox only in about 10% tries goes to wsConnectionPublish.onmessage, on most times I got only wsConnectionPublish.onclose

Is there anyone who knows what is problem with Firefox? Chrome goes to wsConnectionPublish.onmessage with status code 200 each time.

function wsConnectPublish(url)
{
	wsConnectionPublish = new WebSocket(url);
	wsConnectionPublish.binaryType = 'arraybuffer';

	wsConnectionPublish.onopen = function()
	{

		peerConnectionPublish = new RTCPeerConnection(peerConnectionPublishConfig);
		peerConnectionPublish.onicecandidate = gotIceCandidate;
		//code
		
	}

	wsConnectionPublish.onmessage = function(evt)
	{
		//code - firefox got there in only about 1/10 tries
	}

	wsConnectionPublish.onclose = function(evt)
	{
		//code
	}

	wsConnectionPublish.onerror = function(evt)
	{
		//code
	}
}

And this was WebSocket CloseEvent

bubbles: false
cancelBubble: false
cancelable: false
code: 1006
composed: false
currentTarget: null
defaultPrevented: false
eventPhase: 0

explicitOriginalTarget: WebSocket { url: "wss://{THIS_IS_MY_STREAMLOCK_ID}.streamlock.net/webrtc-session.json", readyState: 3, bufferedAmount: 0, … }

isTrusted: true

originalTarget: WebSocket { url: "wss://{THIS_IS_MY_STREAMLOCK_ID}.streamlock.net/webrtc-session.json", readyState: 3, bufferedAmount: 0, … }

reason: ""

target: WebSocket { url: "wss://59ee3fce151d8.streamlock.net/webrtc-session.json", readyState: 3, bufferedAmount: 0, … }

timeStamp: 3059.08880090453
type: "close"
wasClean: false

[explicitOriginalTarget:]
binaryType: "arraybuffer"
bufferedAmount: 0
extensions: ""
onclose: function wsConnectPublish/wsConnectionPublish.onclose()
onerror: function wsConnectPublish/wsConnectionPublish.onerror()
onmessage: function wsConnectPublish/wsConnectionPublish.onmessage()
onopen: function wsConnectPublish/wsConnectionPublish.onopen()
protocol: ""
readyState: 3
url: "wss://{THIS_IS_MY_STREAMLOCK_ID}.streamlock.net/webrtc-session.json"

[originalTarget]
binaryType: "arraybuffer"
bufferedAmount: 0
extensions: ""
onclose: function wsConnectPublish/wsConnectionPublish.onclose()
onerror: function wsConnectPublish/wsConnectionPublish.onerror()
onmessage: function wsConnectPublish/wsConnectionPublish.onmessage()
onopen: function wsConnectPublish/wsConnectionPublish.onopen()
protocol: ""
readyState: 3
url: "wss://{THIS_IS_MY_STREAMLOCK_ID}.streamlock.net/webrtc-session.json"

[target]
binaryType: "arraybuffer"
bufferedAmount: 0
extensions: ""
onclose: function wsConnectPublish/wsConnectionPublish.onclose()
onerror: function wsConnectPublish/wsConnectionPublish.onerror()
onmessage: function wsConnectPublish/wsConnectionPublish.onmessage()
onopen: function wsConnectPublish/wsConnectionPublish.onopen()
protocol: ""
readyState: 3
url: "wss://{THIS_IS_MY_STREAMLOCK_ID}.streamlock.net/webrtc-session.json"

And on Chrome, which works CloseEvent is (difference is that Chrome has currentTarget, and returnValue is true):

bubbles:false
cancelBubble:false
cancelable:false
code:1006
composed:false

currentTarget:WebSocket {url: "wss://{MY_STREAM_LOCK}.streamlock.net/webrtc-session.json", readyState: 3, bufferedAmount: 0, onopen: ƒ, onerror: ƒ, …}

defaultPrevented:false
eventPhase:0
isTrusted:true
path:[]
reason:""
returnValue:true

srcElement:WebSocket {url: "wss://{MY_STREAM_LOCK}.streamlock.net/webrtc-session.json", readyState: 3, bufferedAmount: 0, onopen: ƒ, onerror: ƒ, …}

target:WebSocket {url: "wss://{MY_STREAM_LOCK}.streamlock.net/webrtc-session.json", readyState: 3, bufferedAmount: 0, onopen: ƒ, onerror: ƒ, …}

timeStamp:2378.3650000000002
type:"close"
wasClean:false