From d20ab19fa9ace31cd91714bfe46a465ba7a030b8 Mon Sep 17 00:00:00 2001 From: Benjamin Sergeant Date: Wed, 20 Nov 2019 11:32:18 -0800 Subject: [PATCH] tweaks to the test python proxy code / (moved here) https://gist.github.com/bsergean/bad452fa543ec7df6b7fd496696b2cd8 --- test/compatibility/python/websockets/ws_proxy.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/compatibility/python/websockets/ws_proxy.py b/test/compatibility/python/websockets/ws_proxy.py index 6956f46f..9ec78988 100644 --- a/test/compatibility/python/websockets/ws_proxy.py +++ b/test/compatibility/python/websockets/ws_proxy.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# WS server example +# websocket proxy import argparse import asyncio @@ -8,6 +8,7 @@ import websockets async def hello(websocket, path): + '''Called whenever a new connection is made to the server''' url = REMOTE_URL + path async with websockets.connect(url) as ws: @@ -30,9 +31,12 @@ async def serverToClient(ws, websocket): if __name__ == '__main__': parser = argparse.ArgumentParser(description='websocket proxy.') - parser.add_argument('--host', help='Host to bind to.', default='localhost') - parser.add_argument('--port', help='Port to bind to.', default=8765) - parser.add_argument('--remote_url', help='Remote websocket url', default='ws://localhost:8767') + parser.add_argument('--host', help='Host to bind to.', + default='localhost') + parser.add_argument('--port', help='Port to bind to.', + default=8765) + parser.add_argument('--remote_url', help='Remote websocket url', + default='ws://localhost:8767') args = parser.parse_args() REMOTE_URL = args.remote_url