Add test/compatibility folder with small servers and clients written in different languages and different libraries to test compatibility.

This commit is contained in:
Benjamin Sergeant
2019-06-08 09:46:26 -07:00
parent 9623ceb4d5
commit 051c34bc5d
2 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,22 @@
#!/usr/bin/env python
# WS server example
import asyncio
import websockets
async def hello(websocket, path):
await websocket.send(f"> Welcome !")
name = await websocket.recv()
print(f"< {name}")
greeting = f"Hello {name}!"
await websocket.send(greeting)
print(f"> {greeting}")
start_server = websockets.serve(hello, 'localhost', 8765)
asyncio.get_event_loop().run_until_complete(start_server)
asyncio.get_event_loop().run_forever()