import asyncio
import json
import logging
import websockets

logging.basicConfig()


async def counter(websocket, path):
    try:
        print("connect")
        async for message in websocket:
            print(message)
    finally:
        USERS.remove(websocket)


async def main():
    async with websockets.serve(counter, "localhost", 5000):
        await asyncio.Future()  # run forever


if __name__ == "__main__":
    asyncio.run(main())

[((6, 0, 6, 21), 'logging.basicConfig', 'logging.basicConfig', ({}, {}), '()', False, 'import logging\n'), ((19, 15, 19, 59), 'websockets.serve', 'websockets.serve', ({(19, 32, 19, 39): 'counter', (19, 41, 19, 52): '"""localhost"""', (19, 54, 19, 58): '(5000)'}, {}), "(counter, 'localhost', 5000)", False, 'import websockets\n'), ((20, 14, 20, 30), 'asyncio.Future', 'asyncio.Future', ({}, {}), '()', False, 'import asyncio\n')]