Kite Ticker not connected

pi_bot
Issue with my Kite Ticker WebSocket connection, which is consistently failing with a 403 - Forbidden error. I have performed extensive troubleshooting and diagnostics from my end, and I believe the issue requires server-side investigation.

My setup involves a Python bot running on a Raspberry Pi, integrating with the Kite Connect API. While the REST API (for authentication, holdings, etc.) is working perfectly, the real-time data WebSocket connection is consistently rejected.

Error Message in my Application Logs (consistent):

Connection error: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))
CRITICAL - Kite Ticker Error: Code=1006, Reason=connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))
Timestamp of a recent failed attempt:

Jul 02 10:11:02 ElvenEncoder python[3351]: 2025-07-02 10:11:02,622 - INFO - 192.168.1.34 - - [02/Jul/2025 10:11:02] "GET / HTTP/1.1" 200 -
Jul 02 10:11:06 ElvenEncoder python[3351]: 2025-07-02 10:11:06,199 - WARNING - Kite Ticker not connected. Waiting for real-time data.
Jul 02 10:11:11 ElvenEncoder python[3351]: 2025-07-02 10:11:11,200 - WARNING - Kite Ticker not connected. Waiting for real-time data.
Jul 02 10:11:12 ElvenEncoder python[3351]: 2025-07-02 10:11:12,870 - INFO - 192.168.1.34 - - [02/Jul/2025 10:11:12] "GET / HTTP/1.1" 200 -
Jul 02 10:11:16 ElvenEncoder python[3351]: 2025-07-02 10:11:16,201 - WARNING - Kite Ticker not connected. Waiting for real-time data.
  • Nivas
    Kite Ticker expects valid credentials for connecting to the ticker. If you see a '403' error, then it means either api_key is invalid or the access token is invalid. You may go the similar discussion here.
  • pi_bot
    @Nivas - I tried using the code in the discussion. Still getting the same error. I also tried using Postman.

    wss://ws.kite.trade/?api_key=&access_token=&ci=py

    PSB for the response:

    Handshake Details

    Request Method: GET

    Status Code: 403 Forbidden

    Request Headers
    Sec-WebSocket-Version: 13
    Sec-WebSocket-Key: pXAL8DWS5TcV0fPWWONKaA==
    Connection: Upgrade
    Upgrade: websocket
    Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
    Host: ws.kite.trade
    Response Headers
    Date: Thu, 03 Jul 2025 06:18:29 GMT
    Content-Type: application/json; charset=utf-8
    Content-Length: 53
    Connection: keep-alive
  • pi_bot
    @Nivas Output while running ticker.py:

    python3 test_ticker.py
    2025-07-03 12:12:50,972 - INFO - Using API Key: y5syxmuizyt13u1v and Access Token (first 5 chars): nZ6MR...
    2025-07-03 12:12:50,972 - INFO - Attempting to connect Kite Ticker...
    2025-07-03 12:12:51,132 - ERROR - Connection error: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))
    2025-07-03 12:12:51,132 - ERROR - Kite Ticker Error: Code=1006, Reason=connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))
    2025-07-03 12:12:51,132 - ERROR - Connection closed: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))
    2025-07-03 12:12:51,133 - INFO - Kite Ticker Connection Closed: Code=1006, Reason=connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))
    2025-07-03 12:12:53,917 - ERROR - Connection error: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))
    2025-07-03 12:12:53,917 - ERROR - Kite Ticker Error: Code=1006, Reason=connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))
    2025-07-03 12:12:53,917 - ERROR - Connection closed: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))
    2025-07-03 12:12:53,918 - INFO - Kite Ticker Connection Closed: Code=1006, Reason=connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))
    2025-07-03 12:12:53,918 - WARNING - Kite Ticker Reconnecting (Attempt 1)...
    2025-07-03 12:12:57,082 - INFO - Kite Ticker connection attempt finished (script exited or disconnected).
Sign In or Register to comment.