python - Python Websocket - ConnectionRefusedError:[Errno 111] 连接被拒绝
问题描述
我实际上是在尝试使用带有 localhost 连接的 websocket hello world 示例。
from websocket import create_connection
ws = create_connection("wss://localhost:5000/websocket", timeout=5)
print ("Sending 'Hello, World'...")
ws.send("Hello, World")
print ("Sent")
print ("Receiving...")
result = ws.recv()
print ("Received '%s'" % result)
ws.close()
我得到的错误是:
ConnectionRefusedError: [Errno 111] Connection refused
提前感谢您的帮助
解决方案
推荐阅读
- jquery - 为什么简单的超时在 30 秒后没有触发
- perl - 将 Perl Moose 基类实例重新分配给子类
- angular - 如何在 Typescript Ad-hoc 中扩展类型
- reactjs - 重置令牌参数导致 404
- java - Android:Firebase 动态链接始终会转到 Playstore URL,即使已安装应用程序也是如此
- python - Windows 上的 Python pip - 命令错误“cl.exe”
- python - pysftp.Connection.get IOError:b35d5d74-ecb1-4a41-a9ed-5dde9b15960d
- flutter - 使用 Flutter 和 Dart,这是实现这个 Future 的最佳方式吗?
- sql-server - 为什么我的总数没有正确显示,我该如何解决?
- sql - 如何在 Ruby on Rails 迁移中修复具有“间隙”的列的顺序