diff --git a/examples/websocket_client.py b/examples/websocket_client.py index 3b15a0f..f3cca1f 100755 --- a/examples/websocket_client.py +++ b/examples/websocket_client.py @@ -35,17 +35,27 @@ async def dispatch(): ARGS = argparse.ArgumentParser( description="websocket console client for wssrv.py example." ) +ARGS.add_argument( + "--filter", + action="store", + dest="filter", + default=".*", + help="Regex filter or message name used on websocket: ATTITUDE,HEARTBEAT,RAW_IMU", +) ARGS.add_argument( "--url", action="store", dest="url", - default="http://0.0.0.0:8088/ws/mavlink?filter=.*", - help="Websocket address, follow the format: http://0.0.0.0:8088/ws/mavlink?filter={regex}", + default="http://blueos.local:6040", + help="Websocket address, follow the format: http://0.0.0.0:8088", ) if __name__ == "__main__": args = ARGS.parse_args() - loop = asyncio.get_event_loop() - asyncio.Task(start_client(args.url)) - loop.run_forever() + loop = asyncio.new_event_loop() + loop.run_until_complete( + start_client( + args.url + "/ws/mavlink" + f"?filter={args.filter}" + ) + )