Skip to main content

ASGI wrapper for combining FastAPI and Socket.IO in one app

Project description

asyncutilsx

ASGI wrapper for combining FastAPI and Socket.IO in one app.

Author: Akshat kotpalliwar (alias IntegerAlex)
SPDX-License-Identifier: LGPL-2.1-only

Minimal and pure: one function, no side effects.

Install

pip install asyncutilsx

Usage

from fastapi import FastAPI
from socketio import AsyncServer
from asyncutilsx import asyncplus

app = FastAPI()
sio = AsyncServer(async_mode="asgi")

@sio.event
async def connect(sid, environ):
    print("connect", sid)

asgi_app = asyncplus(app, sio)
# Run with: uvicorn asgi:asgi_app
  • HTTP (except /socket.io/*) → FastAPI
  • HTTP /socket.io/* → Socket.IO (polling)
  • WebSocket → Socket.IO

Development

pip install -e ".[dev]"
pytest

License

LGPL-2.1-only

Project details


Download files

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

Source Distribution

asyncutilsx-0.1.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asyncutilsx-0.1.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file asyncutilsx-0.1.0.tar.gz.

File metadata

  • Download URL: asyncutilsx-0.1.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for asyncutilsx-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7a1007a6d5321d56505ec38a82928f9cb123095d3be2e3ed8d243143622442e0
MD5 d7da3c9c47100311866e021be7762e4c
BLAKE2b-256 706186742631d3e3a98a187e2f959046d1c418c2ccb01c5a204c0e36cce8425e

See more details on using hashes here.

File details

Details for the file asyncutilsx-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: asyncutilsx-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for asyncutilsx-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5830b57e052c2e76eec670b83754e514dd661e5b65481e5c2d69811cb3ae1629
MD5 9bb2dbcd1b06e26a405363af7161a8e5
BLAKE2b-256 64b6905853e365b054fc59aac4fdca7fc35364aa0d9fa75db4a54fdffdc31f8f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page