Establishing the Websocket with Client Portal Gateway

View as MarkdownOpen in Claude

Next, you will need to build your websocket to wss://localhost:5000/v1/api/ws. In your request to establish the websocket, be sure to set your cookie header as “api={‘session’ value here}”

1ws = websocket.WebSocketApp(
2 url="wss://localhost:5000/v1/api/ws",
3 on_open=on_open,
4 on_message=on_message,
5 on_error=on_error,
6 on_close=on_close,
7 cookie=f"api={sessionToken}"
8)
9ws.run_forever()