下面文章小编就为大家带来一篇浅谈swoole websocket Failed to construct 'WebSocket': The URL's scheme must be either 'ws' or 'wss'. 'http' is not allowed.。小编觉得挺不错的,现在就分享给大家,如果你在找websocket教程,swoole使用,swoole教程,也可以做个学习。一起跟随小编过来看看吧。
swoole websocket Failed to construct 'WebSocket': The URL's scheme must be either 'ws' or 'wss'. 'http' is not allowed.
作者:小程序分析员 发布时间:2018-05-14
swoole websocket 可以跟客户端建立长连接,
在 js 中连接 swoole websocket 时,
出现下面的错误提示:
Failed to construct 'WebSocket': The URL '192.168.1.250:9876' is invalid
Uncaught DOMException: Failed to construct 'WebSocket': The URL's scheme must be either 'ws' or 'wss'. 'http' is not allowed.
意思是要使用 ws或wss协议,
不能使用 http
原因在 js 中没有写协议导致,
修改好即可
var wsUrl = 'ws://192.168.1.250:9876';
声明:部分文章或图片未能及时与原作者取得联系,若来源标注错误或侵犯到您的权益烦请告知QQ:2334512685,我们会及时删除。
发布:秦子恒博客,欢迎转载分享,请保留出处。
swoole websocket Failed to construct 'WebSocket': The URL's scheme must be either 'ws' or 'wss'. 'http' is not allowed.链接:https://www.qinziheng.com/details/6568/
swoole websocket Failed to construct 'WebSocket': The URL's scheme must be either 'ws' or 'wss'. 'http' is not allowed.相关文章