diff --git a/src/api_communication/api_communication/api_listener.py b/src/api_communication/api_communication/api_listener.py index ae574860..35f5caf2 100644 --- a/src/api_communication/api_communication/api_listener.py +++ b/src/api_communication/api_communication/api_listener.py @@ -84,7 +84,7 @@ class ApiListener(Node): async def handle_api(self): self.get_logger().info('Starting API') self.server = await websockets.serve(self.api_handler, '0.0.0.0', 9001) - self.get_logger().info('API started') + self.get_logger().info('API started on port 9001') await self.server.wait_closed() def process_image_request(self, message_json): diff --git a/websocket-client-test.py b/websocket-client-test.py new file mode 100644 index 00000000..a3ce0699 --- /dev/null +++ b/websocket-client-test.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +import asyncio +from websockets.sync.client import connect + +def hello(): + with connect("ws://localhost:8765") as websocket: + websocket.send("Hello world!") + message = websocket.recv() + print(f"Received: {message}") + +hello()