Skip to content

ConnectionRefusedError not working #487

@databasedav

Description

@databasedav

This is on Python 3.8.2 with

python-engineio==3.12.1
python-socketio==4.5.1
uvicorn==0.11.5

and you can reproduce with

# server.py
import socketio
from socketio.exceptions import ConnectionRefusedError

sock = socketio.ASGIApp(
    socketio.AsyncServer(async_mode="asgi"),
)

@sock.engineio_server.event
async def connect(sid, environ):
    # raise Exception()
    raise ConnectionRefusedError()
# client.py
import asyncio
import socketio

async def test():
    c = socketio.AsyncClient()
    await c.connect('ws://localhost:8002')
    await asyncio.sleep(1)
    await c.disconnect()
    await asyncio.sleep(1)

asyncio.run(test())

and running uvicorn --host 0.0.0.0 --port 8002 server:sock and python client.py

raising an Exception produces the expected behavior.

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions