Skip to main content

Easly integrate with your FastAPI app.

Project description


PyPI Changelog License

Easly integrate with your FastAPI app.


Install this plugin using pip:

$ pip install fastapi-socketio


To add SocketIO support to FastAPI all you need to do is import SocketManager and pass it FastAPI object.

from fastapi import FastAPI
from fastapi_socketio import SocketManager

app = FastAPI()
socket_manager = SocketManager(app=app)

Now you can use SocketIO directly from your FastAPI app object.

from .app import app

async def handle_join(sid, *args, **kwargs):
    await app.sio.emit('lobby', 'User joined')

Or you can import SocketManager object that exposes most of the SocketIO functionality.

from .app import socket_manager as sm

async def handle_leave(sid, *args, **kwargs):
    await sm.emit('lobby', 'User left')


To contribute to this library, first checkout the code. Then create a new virtual environment:

cd fastapi-socketio
python -mvenv venv
source venv/bin/activate

Or if you are using pipenv:

pipenv shell

Now install the dependencies and tests:

pip install -e '.[test]'

To run the tests:


Run example

To run the examples simply run:

PYTHONPATH=. python examples/

Before running example make sure you have all dependencies installed.


For list of contributors please reefer to file in this repository.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for fastapi-socketio, version 0.0.7
Filename, size File type Python version Upload date Hashes
Filename, size fastapi_socketio-0.0.7-py3-none-any.whl (7.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size fastapi-socketio-0.0.7.tar.gz (7.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page