feat: Semaine 9

This commit is contained in:
gauvainboiche
2026-05-15 16:24:56 +02:00
parent 3315cb2336
commit ce1f0e513a
108 changed files with 3150 additions and 0 deletions
@@ -0,0 +1,23 @@
# client
import asyncio
import websockets
async def recevoir(websocket):
async for message in websocket:
print(f"\n[Message reçu] {message}")
async def envoyer(websocket):
while True:
message = await asyncio.get_event_loop().run_in_executor(None, input, "Vous : ")
await websocket.send(message)
async def main():
uri = "ws://localhost:8765"
async with websockets.connect(uri) as websocket:
print("Connecté au chat. Tapez vos messages.")
await asyncio.gather(
recevoir(websocket),
envoyer(websocket),
)
asyncio.run(main())