在建立连接之前“WebSocket是关闭的”是什么意思?

编程入门 行业动态 更新时间:2024-10-24 02:30:48
本文介绍了在建立连接之前“WebSocket是关闭的”是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用JavaScript和联盟平台我将如何诊断此问题?非常感谢。

I'm using JavaScript and the Union platform How would I go about diagnosing this problem? Many thanks.

推荐答案

如果你去 jsbin/ekusep/6/edit 并查看JavaScript控制台,您将看到在建立连接之前WebSocket已关闭已记录。我在Chrome中对此进行了测试。

If you go to jsbin/ekusep/6/edit and view the JavaScript console you'll see the 'WebSocket is closed before the connection is established' logged. I've tested this in Chrome.

在此代码中,含义是 ws.close()是在连接被提供机会之前调用(通过用户代码)。

In this code what it means is that ws.close() was called (by user code) before the connection was even given a chance to be established.

因此,此错误的原因是代码尝试关闭WebSocket连接之前它有机会实际连接。

So, the cause of this error is if code attempts to close the WebSocket connection before it's had a chance to actually connect.

更多推荐

在建立连接之前“WebSocket是关闭的”是什么意思?

本文发布于:2023-10-30 23:51:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1544373.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:WebSocket

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!