Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

PY | websocket - server

#!/usr/bin/env python

import asyncio
import websockets

async def echo(websocket, path):
    async for message in websocket:
        await websocket.send(message)

asyncio.get_event_loop().run_until_complete(
    websockets.serve(echo, 'localhost', 8765))
asyncio.get_event_loop().run_forever()
Source by pythonrepo.com #
 
PREVIOUS NEXT
Tagged: #PY #websocket #server
ADD COMMENT
Topic
Name
6+3 =