我正在使用 opentok 客户端 JS api OpenTok.js 2.14.6 753045900 来设置视频 session 应用程序。间歇性地,它会向 chrome 控制台抛出错误:
WebSocket connection to 'wss://mantis002-ams.tokbox.com/rumorwebsocketsv2?socketId=12796b11-4174-431e-980f-52c29c32aa0d&attempt=b58d3a4d-7721-4e93-b39b-76224b00864a' failed: WebSocket is closed before the connection is established.
WebSocket connection to 'wss://mantis002-ams.tokbox.com/rumorwebsocketsv2?socketId=12796b11-4174-431e-980f-52c29c32aa0d&attempt=0d49b33e-33b9-4eec-a6d4-80ea6d7908ec' failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT
OT:RumorSocket:1 Error code unavailable.
OT.Raptor.Socket error: e {code: 4020, message: "Error code unavailable."}
OT_SOCKET_CLOSE_FALLBACK_CODE: Error code unavailable.
OT.exception :: title: undefined (4020) msg: Error code unavailable.
s {code: 4020, message: "Error code unavailable.", name: "OT_SOCKET_CLOSE_FALLBACK_CODE", stack: "Error: Error code unavailable.↵ at https://stat…tatic.opentok.com/v2/js/opentok.min.js:29:247034)"}
An error occurred in an event handler TypeError: Cannot read property 'id' of
null
at index.js:455
at P (RaptorSocket.js:75)
at r (RaptorSocket.js:265)
at d.triggerCallback (Dispatcher.js:32)
at n.<anonymous> (SessionDispatcher.js:179)
at n.emit (events.js:84)
at d.trigger (eventing.js:321)
at d.emit (eventing.js:330)
at RaptorSocket.js:279
如何正确处理这种情况,因为重新连接似乎在 OpenTok.js 中不起作用? 当我尝试重新创建 session 时,我收到了
OT.exception :: title: Unexpected Server Response (2001) msg: Unexpected server response. Try this operation again later.
{ code: 2001, message: "Unexpected server response. Try this operation again later.", name: "OT_UNEXPECTED_SERVER_RESPONSE", stack: "Error: Unexpected server response. Try this operat…/static.opentok.com/v2/js/opentok.min.js:23:8742)"}
mixin.js:23 OT:RumorSocket:49 The connection is being terminated because the endpoint has indicated that reconnections are not available. (CLOSE_UNSUPPORTED)
最佳答案
这里是 TokBox 开发者传播者。
能否将 sessionId 和日志一起发送到 support@tokbox.com?支持团队将能够帮助您发现根本问题。您还可以使用 Session Inspector高级摘要工具,可帮助您查明连接错误。
关于javascript - OpenTok JS websocket 连接超时问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50927600/