@@ -28,6 +28,7 @@ class SocketIOChatBridge:
2828 def __init__ (
2929 self ,
3030 websocket_url : str ,
31+ websocket_path : str ,
3132 conversation_id : str ,
3233 exchange_id : str ,
3334 headers : dict [str , str ],
@@ -43,6 +44,7 @@ def __init__(
4344 auth: Optional authentication data to send during connection
4445 """
4546 self .websocket_url = websocket_url
47+ self .websocket_path = websocket_path
4648 self .conversation_id = conversation_id
4749 self .exchange_id = exchange_id
4850 self .auth = auth
@@ -85,11 +87,12 @@ async def connect(self, timeout: float = 10.0) -> None:
8587
8688 try :
8789 # Attempt to connect with timeout
88- logger .info (f"Connecting to WebSocket server: { self .websocket_url } " )
90+ logger .info (f"Connecting to WebSocket server: { self .websocket_url } + { self . websocket_path } " )
8991
9092 await asyncio .wait_for (
9193 self ._client .connect (
9294 url = self .websocket_url ,
95+ socketio_path = self .websocket_path ,
9396 headers = self .headers ,
9497 auth = self .auth ,
9598 transports = ["websocket" ],
@@ -260,20 +263,22 @@ def get_chat_bridge(
260263 host = parsed .netloc
261264
262265 # Construct WebSocket URL for CAS
263- websocket_url = f"wss://{ host } /autopilotforeveryone_/websocket_/socket.io?conversationId={ context .conversation_id } "
266+ websocket_url = f"wss://{ host } ?conversationId={ context .conversation_id } "
267+ websocket_path = "autopilotforeveryone_/websocket_/socket.io"
264268
265269 # Build headers from context
266270 headers = {
267271 "Authorization" : f"Bearer { os .environ .get ('UIPATH_ACCESS_TOKEN' , '' )} " ,
268- "X-UiPath-Internal-TenantId" : context .tenant_id
272+ "X-UiPath-Internal-TenantId" : f" { context .tenant_id } "
269273 or os .environ .get ("UIPATH_TENANT_ID" , "" ),
270- "X-UiPath-Internal-AccountId" : context .org_id
274+ "X-UiPath-Internal-AccountId" : f" { context .org_id } "
271275 or os .environ .get ("UIPATH_ORGANIZATION_ID" , "" ),
272276 "X-UiPath-ConversationId" : context .conversation_id ,
273277 }
274278
275279 return SocketIOChatBridge (
276280 websocket_url = websocket_url ,
281+ websocket_path = websocket_path ,
277282 conversation_id = context .conversation_id ,
278283 exchange_id = context .exchange_id ,
279284 headers = headers ,
0 commit comments