Made them communicate but somehow broke "hello" messages

This commit is contained in:
2025-02-07 21:16:33 +01:00
parent 9425c2cccc
commit e2869fb8a2
8 changed files with 125 additions and 2 deletions
+20
View File
@@ -0,0 +1,20 @@
import websockets
from macros import py_print
ws_global = None
async def send_message(message: str):
global ws_global
if ws_global:
await ws_global.send(message)
async def websocket_client():
global ws_global
async with websockets.connect("ws://127.0.0.1:9001") as ws:
ws_global = ws
py_print("Connected webSocket server on ws://127.0.0.1:9001")
while True:
response = await ws.recv()
py_print(f"Received from Rust: {response}")