Getting the following error while connecting user to order WebSocket
data WebSocket is working fine with the same access token used in order WebSocket
Using fyers python module v3
ERRORError: Handshake status 403 Forbidden -+-+- {'date': 'Fri, 15 Dec 2023 06:38:16 GMT', 'content-length': '0', 'connection': 'keep-alive', 'cf-cache-status': 'DYNAMIC', 'set-cookie': '__cf_bm=o0FV_1pNGoXEsXWzQ73K20ziXA2.1nVaSZK.QJ2xAU0-1702622296-1-AZaZeIN0vyezqbx6xMWmzOZfROYqBjSqQYVlrxiMUI6dRTaI2R2KQaE635jPk8GX8kgU87wbuDIpRTK3qN6CqgM=; path=/; expires=Fri, 15-Dec-23 07:08:16 GMT; domain=.fyers.in; HttpOnly; Secure; cfuvid=QyNSCNCJB9Idnv7YxG2obpcjTkD5bfDbkHTqcy_Ax0-1702622296050-0-604800000; path=/; domain=.fyers.in; HttpOnly; Secure; SameSite=None', 'server': 'cloudflare', 'cf-ray': '835caec59d6329f0-BOM'} -+-+- b''
Connection closed: {'code': 200, 'message': 'Connection Closed', 's': 'ok'}
The Code Used is
from fyers_apiv3.FyersWebsocket import order_ws
def onOrder(message):
print("Order Response:", message)
def onerror(message):
print("Error:", message)
def onclose(message):
print("Connection closed:", message)
def onopen():
data_type = "OnOrders"
fyers.subscribe(data_type=data_type)
fyers.keep_running()
access_token = "access_token" # access token was used here
fyers = order_ws.FyersOrderSocket(
access_token=access_token,
write_to_file=False,
log_path="",
on_connect=onopen,
on_close=onclose,
on_error=onerror,
on_orders=onOrder,
)
# Establish a connection to the Fyers WebSocket
fyers.connect()