WebSocket Connection Error

alphamurho
Im getting the following error when I try to connect to KiteTicker..

Connection error: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403)

Found a similar post but that was a little different then what Im facing.
Tagged:
  • sujith
    It means authentication is failing. It means either you are passing an invalid access token or api_key.
  • alphamurho
    alphamurho edited May 2018
    Not sure if that is the reason.. Have the following code:


    API_KEY = 'xxxx'
    REQUEST_TOKEN = 'yyy'
    API_SECRET = 'zzz'

    kite = KiteConnect(api_key=API_KEY)
    kws = KiteTicker(API_KEY, REQUEST_TOKEN)

    data = kite.generate_session(REQUEST_TOKEN, api_secret = API_SECRET )

    # THIS IS WORKING:
    all_instruments = kite.instruments(exchange = kite.EXCHANGE_NFO)

    # Assign the callbacks
    kws.on_ticks = on_ticks
    kws.on_connect = on_connect
    kws.on_close = on_close

    # THIS THROWS ERROR
    kws.connect()
  • alphamurho
    alphamurho edited May 2018
    My bad. I didn't know access token and request token were different
    Can close
This discussion has been closed.