Is it possible to first establish a ws:// connection (not SSL encrypted) and then after communicating a bit switch to wss:// ond the same connection (and vice versa)?
Since WebSockets are long living connections, it seems to make sense to me. And I really would need it in one of my projects...
You can't switch from unencrypted (ws) to encrypted (wss) in the same socket connection. You could establish two connections from the start and just not use the encrypted one until you are ready if you are concerned about setup latency. Otherwise, just create a new encrypted session when you are ready.