☰
Login
Signup
Home
›
Python client
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Register
Categories
Recent Discussions
Activity
Categories
13.8K
All Categories
0
Incidents
154
Node JS client
40
Go client
793
.Net API client
378
Kite Publisher
537
.Net / VBA / Excel (3rd party)
457
Algorithms and Strategies
993
Java client
1.1K
API clients
404
PHP client
4K
Python client
346
Mobile and Desktop apps
1.4K
Market data (WebSockets)
3.3K
General
In this Discussion
October 2022
rakeshr
Websocket Reactornotrestartable
GH3054
October 2022
in
Python client
Hi team,
I am getting the following error when I am trying to run the websocket code. I am running this code on spyder.
import logging
from kiteconnect import KiteTicker
# Initialise
kws = KiteTicker("apikey", "access_token", debug=True)
def on_ticks(ws, ticks):
print(ticks)
def on_connect(ws, response):
logging.debug("on connect: {}".format(response))
ws.subscribe([738561, 5633])
ws.set_mode(ws.MODE_FULL, [738561])
def on_close(ws, code, reason):
logging.error("closed connection on close: {} {}".format(code, reason))
def on_error(ws, code, reason):
logging.error("closed connection on error: {} {}".format(code, reason))
def on_noreconnect(ws):
logging.error("Reconnecting the websocket failed")
def on_reconnect(ws, attempt_count):
logging.debug("Reconnecting the websocket: {}".format(attempt_count))
def on_order_update(ws, data):
print("order update: ", data)
# Assign the callbacks.
kws.on_ticks = on_ticks
kws.on_connect = on_connect
kws.on_close = on_close
kws.on_error = on_error
kws.on_noreconnect = on_noreconnect
kws.on_reconnect = on_reconnect
kws.on_order_update = on_order_update
# Infinite loop on the main thread. Nothing after this will run.
# You have to use the pre-defined callbacks to manage subscriptions.
kws.connect()
Tagged:
#ReactorNotRestartable
rakeshr
October 2022
Go through WebSocket
FAQs here
.
Sign In
or
Register
to comment.