" ereactornotrestartable()twisted.internet.error.ReactortRestrestable&quort&quort- Binance websocket API

发布于 2025-01-21 15:06:41 字数 648 浏览 4 评论 0 原文

我对Websocket有一个问题。我从给我以下错误 - “警告:root:websocket Connection:websocket Connection:nockocket Connection:nocked notectly:nocked note connection notectally(connection nocked notally(同行在没有以前的WebSocket关闭握手的情况下丢弃了TCP连接),代码:1006,Clean:False,原因:连接不清楚(Peer丢弃了TCP连接而没有以前的WebSocket闭合握手)”。

每当我尝试重新运行示例时,我都会得到错误“ error.ReactorNotrestable() '。

twisted.internet.error.reactortorrestartable 可行的解决方案。 ws_client = futureswebsocketclient(),ws_client.stop() 正在引起这个问题。

I am getting an issue with websocket. Any example I run from https://github.com/Binance-docs/binance-futures-connector-python/tree/main/examples/websocket/futures gives me the following error - "WARNING:root:WebSocket connection closed: connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake), code: 1006, clean: False, reason: connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)".

Whenever I try to rerun the examples I get the error "error.ReactorNotRestartable()
twisted.internet.error.ReactorNotRestartable".

I have found out that I can escape this error by uninstalling and then reinstalling the twisted library. But then I have to repeat the reinstallment every time I want to start the websocket. Since this isn't a feasible solution. Can someone here help me with how to resolve this issue? What would be the most appropriate way to close the websocket connection since
ws_client = FuturesWebsocketClient(), ws_client.stop()
is causing this issue.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

回忆那么伤 2025-01-28 15:06:41

扭曲的反应堆目前不可重新启动。您最多可以安装每个过程,最多可以运行一次。

您的Jupyer笔记本电脑正在以一个长期寿命的Python过程中运行,因此您仅限于您正在尝试的任何运行反应器互动。

我不知道您的意思是“卸载和重新安装扭曲”,但是一般的解决方案是安排您的代码,这样您只需要运行一次扭曲的反应堆(即,在完成所有操作之前就不要停止它您想做)或为扭曲的可重启反应堆贡献。

或者,也许,停止在jupyter笔记本中运行代码,然后将其运行,以不同的过程使用寿命。

Twisted's reactors are presently not restartable. You can install at most one per process and you can run it at most once.

Your Jupyer notebook is running in a single long-lived Python process so you are limited to a single of whatever run-the-reactor interaction you are attempting.

I don't know what you mean by "uninstalling and reinstalling Twisted" but the general solution is to arrange your code so that you only need to run a Twisted reactor once (ie, don't stop it before you're done with everything you want to do) or contribute restartable reactors to Twisted.

Or, perhaps, stop running your code in a Jupyter Notebook and run it in something with a different process lifetime instead.

○闲身 2025-01-28 15:06:41

请尝试使用最新版本,Websocket部分已重新设计。

Please have a try with the latest version, the Websocket part has been redesigned.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文