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

Commit 346991e

Browse files
authored
Merge pull request #7 from MatthewScholefield/patch-1
Use cors_allowed_origins in AsyncServer
2 parents 0e0cd2b + 890d8ae commit 346991e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fastapi_socketio/socket_manager.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import socketio
2+
from typing import Union
23
from fastapi import FastAPI
34

45

@@ -21,10 +22,10 @@ def __init__(
2122
app: FastAPI,
2223
mount_location: str = "/ws",
2324
socketio_path: str = "socket.io",
24-
cors_allowed_origins: list = [],
25+
cors_allowed_origins: Union[str, list] = '*',
2526
) -> None:
2627
# TODO: Change Cors policy based on fastapi cors Middleware
27-
self._sio = socketio.AsyncServer(async_mode="asgi", cors_allowed_origins="*")
28+
self._sio = socketio.AsyncServer(async_mode="asgi", cors_allowed_origins=cors_allowed_origins)
2829
self._app = socketio.ASGIApp(
2930
socketio_server=self._sio, socketio_path=socketio_path
3031
)

0 commit comments

Comments
 (0)