Connection getting dropped after an hour or so

suvesh
Hi

Kiteconnect version - 3.7.0.b9

I get the tick stream without any problem but the web socket connection is broken after an hour so with following error:


2018-07-16 11:11:01+0530 [-] dropping connection to peer tcp4:xx.xx.xxx.xx:443 with abort=True
2018-07-16 11:11:02+0530 [-] Connection error: 1006 - connection was closed uncleanly (None)
2018-07-16 11:11:02+0530 [-] On Error got called
2018-07-16 11:11:02+0530 [-] connection was closed uncleanly (None)
2018-07-16 11:11:02+0530 [-] Connection closed: 1006 - connection was closed uncleanly (None)
2018-07-16 11:11:02+0530 [-] Unhandled Error

Here is the stack trace:
File "...\live_bar_price_handler_websocket.py", line 164, in start_streaming
self.kws.connect()
File "\Anaconda\envs\py3.5\lib\site-packages\kiteconnect-3.7.0b9-py3.5.egg\kiteconnect\ticker.py", line 521, in connect

File "\Anaconda\envs\py3.5\lib\site-packages\twisted\internet\base.py", line 1243, in run
self.mainLoop()
File "\Anaconda\envs\py3.5\lib\site-packages\twisted\internet\base.py", line 1252, in mainLoop
self.runUntilCurrent()
--- ---
File "\Anaconda\envs\py3.5\lib\site-packages\twisted\internet\base.py", line 878, in runUntilCurrent
call.func(*call.args, **call.kw)
File "\Anaconda\envs\py3.5\lib\site-packages\twisted\internet\tcp.py", line 475, in connectionLost
self._commonConnection.connectionLost(self, reason)
File "\Anaconda\envs\py3.5\lib\site-packages\twisted\internet\tcp.py", line 289, in connectionLost
protocol.connectionLost(reason)
File "\Anaconda\envs\py3.5\lib\site-packages\twisted\protocols\tls.py", line 403, in connectionLost
ProtocolWrapper.connectionLost(self, reason)
File "\Anaconda\envs\py3.5\lib\site-packages\twisted\protocols\policies.py", line 125, in connectionLost
self.wrappedProtocol.connectionLost(reason)
File "\Anaconda\envs\py3.5\lib\site-packages\autobahn\twisted\websocket.py", line 128, in connectionLost
self._connectionLost(reason)
File "\Anaconda\envs\py3.5\lib\site-packages\autobahn\websocket\protocol.py", line 3357, in _connectionLost
WebSocketProtocol._connectionLost(self, reason)
File "\Anaconda\envs\py3.5\lib\site-packages\autobahn\websocket\protocol.py", line 1096, in _connectionLost
self._onClose(self.wasClean, WebSocketProtocol.CLOSE_STATUS_CODE_ABNORMAL_CLOSE, "connection was closed uncleanly (%s)" % self.wasNotCleanReason)
File "\Anaconda\envs\py3.5\lib\site-packages\autobahn\twisted\websocket.py", line 171, in _onClose
self.onClose(wasClean, code, reason)
File "\Anaconda\envs\py3.5\lib\site-packages\kiteconnect-3.7.0b9-py3.5.egg\kiteconnect\ticker.py", line 81, in onClose

File "\Anaconda\envs\py3.5\lib\site-packages\kiteconnect-3.7.0b9-py3.5.egg\kiteconnect\ticker.py", line 641, in _on_close

builtins.TypeError: on_close() takes 3 positional arguments but 4 were given

Any help is greatly appreciated!

Thanks

Suvesh

  • rakeshr
    @suvesh
    builtins.TypeError: on_close() takes 3 positional arguments but 4 were given
    Are you adding extra param in on_close(ws, code, reason), there should be just these three params as input to on_close method.
Sign In or Register to comment.