Created
February 24, 2022 18:11
-
-
Save gofman/863f295effd6dc2be692c2c480c4225f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import asyncio | |
import websockets | |
async def fragmented_reply(websocket, path): | |
print("Client connected") | |
await websocket.send(["fragment1", "fragment2", "fragment3"]) | |
print("Reply sent") | |
event_loop = asyncio.new_event_loop() | |
asyncio.set_event_loop(event_loop) | |
server = websockets.serve(fragmented_reply, '0.0.0.0', 12345) | |
event_loop.run_until_complete(server) | |
event_loop.run_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment