File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -25,16 +25,23 @@ def __init__(
2525 self .id = uuid .uuid4 () if id is None else id
2626 log .info (f"Opening websocket connection for Client { self .id } " )
2727 websocket .enableTrace (True )
28- url = urllib .parse .urlparse (server )._replace (scheme = "ws" , path = "" )
28+
29+ url = urllib .parse .urlparse (server )._replace (scheme = "ws" )
30+ proxy_path = url .path # Path component indicates what the proxy path used was
31+
2932 self ._address = url .geturl ()
3033 self ._alive = True
3134 self ._ready = False
3235 self ._send_queue : queue .Queue [Optional [str ]] = queue .Queue ()
3336 self ._receive_queue : queue .Queue [Optional [str ]] = queue .Queue ()
37+
38+ # Construct the websocket URL
39+ # Prepend the proxy path to the new URL path
40+ # It will evaluate to "" if nothing's there, and starts with "/path" if present
3441 ws_url = (
35- url ._replace (path = f"/ws/test/{ self .id } " ).geturl ()
42+ url ._replace (path = f"{ proxy_path } /ws/test/{ self .id } " ).geturl ()
3643 if register_client
37- else url ._replace (path = f"/ws/connect/{ self .id } " ).geturl ()
44+ else url ._replace (path = f"{ proxy_path } /ws/connect/{ self .id } " ).geturl ()
3845 )
3946 self ._ws = websocket .WebSocketApp (
4047 ws_url ,
You can’t perform that action at this time.
0 commit comments