Skip to content
This repository was archived by the owner on Apr 4, 2024. It is now read-only.

Commit e50ac9b

Browse files
committed
Add better docsting for SocketManager
1 parent b0ffa4e commit e50ac9b

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

fastapi_socketio/socket_manager.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@
44

55
class SocketManager:
66
"""
7-
Creates and mounts SocketIO app to FastAPI app.
8-
Default mount location for SocketIO app is "/ws".
7+
Integrates SocketIO with FastAPI app.
8+
Adds `sio` property to FastAPI object (app).
99
10-
Exponses basic functionality of SocketIO.
10+
Default mount location for SocketIO app is at `/ws`
11+
and defautl SocketIO path is `socket.io`.
12+
(e.g. full path: `ws://www.example.com/ws/socket.io/)
1113
12-
Default socketio_path is "socket.io"
14+
SocketManager exposes basic underlying SocketIO functionality
15+
16+
e.g. emit, on, send, call, etc.
1317
"""
1418

1519
def __init__(
@@ -19,7 +23,7 @@ def __init__(
1923
socketio_path: str = "socket.io",
2024
cors_allowed_origins: list = [],
2125
) -> None:
22-
26+
# TODO: Change Cors policy based on fastapi cors Middleware
2327
self._sio = socketio.AsyncServer(async_mode="asgi", cors_allowed_origins="*")
2428
self._app = socketio.ASGIApp(
2529
socketio_server=self._sio, socketio_path=socketio_path
@@ -81,4 +85,4 @@ def start_background_task(self):
8185

8286
@property
8387
def sleep(self):
84-
return self._sio.sleep
88+
return self._sio.sleep

fastapi_socketio/socket_router.py

Whitespace-only changes.

0 commit comments

Comments
 (0)