Skip to content

Commit 781b8b3

Browse files
committed
Try websockets 11.0+ import first, then fall back to <11.0
1 parent a575f5c commit 781b8b3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sanic/server/websockets/impl.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
from websockets.frames import Frame, Opcode
1717

1818

19-
try: # websockets < 11.0
20-
from websockets.connection import Event, State # type: ignore
21-
from websockets.server import ServerConnection as ServerProtocol
22-
except ImportError: # websockets >= 11.0
19+
try: # websockets >= 11.0
2320
from websockets.protocol import Event, State # type: ignore
2421
from websockets.server import ServerProtocol # type: ignore
22+
except ImportError: # websockets < 11.0
23+
from websockets.connection import Event, State # type: ignore
24+
from websockets.server import ServerConnection as ServerProtocol
2525

2626
from websockets.typing import Data
2727

0 commit comments

Comments
 (0)