博客
关于我
on_close() missing 1 required positional argument: 'ws'
阅读量:341 次
发布时间:2019-03-04

本文共 897 字,大约阅读时间需要 2 分钟。

  • 问题描述

    class Something():    def on_message(self,ws, message):        pass    ...    def main(self):            websocket.enableTrace(True)            ws = websocket.WebSocketApp("wss://stream.binance.com:9443/ws/btcusdt@trade",                                    on_message = self.on_message,                                    on_error = self.on_error,                                    on_close = self.on_close)

    websocket实例写入一个类,此时调用self.on_message出现如题问题。

  • 解决方案

    class Something():    def on_message(self, message): # 将ws去掉,self占位ws        pass    ...    def main(self):            websocket.enableTrace(True)            ws = websocket.WebSocketApp("wss://stream.binance.com:9443/ws/btcusdt@trade",                                    on_message = self.on_message,                                    on_error = self.on_error,                                    on_close = self.on_close)
  • References

转载地址:http://jwge.baihongyu.com/

你可能感兴趣的文章
并发编程——IO模型详解
查看>>
Java之封装,继承,多态
查看>>
wait()与notify()
查看>>
使用js打印时去除页眉页脚
查看>>
Spring security OAuth2.0认证授权学习第二天(基础概念-RBAC)
查看>>
ORA-00904: "FILED_TYPE": 标识符无效
查看>>
数据仓库系列之维度建模
查看>>
Scala教程之:函数式的Scala
查看>>
java中DelayQueue的使用
查看>>
java程序员从小工到专家成神之路(2020版)-持续更新中,附详细文章教程
查看>>
线程stop和Interrupt
查看>>
Android中定时执行任务的3种实现方法
查看>>
nodejs中npm常用命令
查看>>
mybatis一个怪异的问题: Invalid bound statement not found
查看>>
基于Vue2.0+Vue-router构建一个简单的单页应用
查看>>
基于vue2.0实现仿百度前端分页效果(二)
查看>>
JS魔法堂:函数重载 之 获取变量的数据类型
查看>>
时间序列神器之争:Prophet VS LSTM
查看>>
SpringBoot中关于Mybatis使用的三个问题
查看>>
MapReduce实验
查看>>