Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以先建立一个 ws:// 连接(不是 SSL 加密的),然后在与 wss:// 通信后在同一连接上进行位切换(反之亦然)?
由于 WebSocket 是长期存在的连接,因此对我来说似乎很有意义。我真的需要它在我的一个项目中......
您不能在同一个套接字连接中从未加密 (ws) 切换到加密 (wss)。如果您担心设置延迟,您可以从一开始就建立两个连接,并且在准备好之前不要使用加密的连接。否则,只需在准备好后创建一个新的加密会话。