async def METHOD_NAME(request, atv):
    """Handle incoming websocket requests."""
    device_id = request.match_info["id"]
    ws = web.WebSocketResponse()
    await ws.prepare(request)
    request.app["clients"].setdefault(device_id, []).append(ws)
    playstatus = await atv.metadata.playing()
    await ws.send_str(str(playstatus))
    async for msg in ws:
        if msg.type == WSMsgType.TEXT:
            # Handle custom commands from client here
            if msg.data == "close":
                await ws.close()
        elif msg.type == WSMsgType.ERROR:
            print(f"Connection closed with exception: {ws.exception()}")
    request.app["clients"][device_id].remove(ws)
    return ws