Skip to content
Discussion options

You must be logged in to vote

I don't have an exact solution for you, but here's a couple of pointers that might help:

Socket.io vs WebSockets

Based on your JS example, it looks like you may be confusing socket.io with WebSockets. socket.io uses WebSockets and other technologies under the hood to create a robust realtime connection.

Fastapi + Socket.io

If your tech stack includes socket.io, consider fastapi-socketio to integrate with FastAPI.

This should let you define 'routes' like so (untested):

from fastapi import FastAPI
from fastapi_socketio import SocketManager

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

@sm.on("phone.calling")
async def handle_join(sid):
    await app.sio.emit('lobby', "phone.call")

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Kludex
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem question-migrate
2 participants
Converted from issue

This discussion was converted from issue #4748 on February 28, 2023 15:57.