When using ssl, we lock the WebSocket client connection establishment with globals.mutex, then on channel init at the beginning we lock also with globals.mutex to increase the counter for the number of calls and after that we modify the first message. Since it's being locked only for WSS the channel init logic for adding the headers is not being done in proper timing (The lock can only be acquired once websocket is established).
Fix: change locking to be done after the object is modified.
When using ssl, we lock the WebSocket client connection establishment with globals.mutex, then on channel init at the beginning we lock also with globals.mutex to increase the counter for the number of calls and after that we modify the first message. Since it's being locked only for WSS the channel init logic for adding the headers is not being done in proper timing (The lock can only be acquired once websocket is established).
Fix: change locking to be done after the object is modified.