Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebSockets for Continuous Data Transmission #38

Open
Wytamma opened this issue Mar 15, 2024 · 1 comment
Open

WebSockets for Continuous Data Transmission #38

Wytamma opened this issue Mar 15, 2024 · 1 comment

Comments

@Wytamma
Copy link
Owner

Wytamma commented Mar 15, 2024

Replace polling with web sockets e.g.

from fastapi import FastAPI, WebSocket

app = FastAPI()

@app.websocket("/data")
async def data_websocket(websocket: WebSocket):
    await websocket.accept()
    while True:
        data = await generate_data()  # Your function to get real-time data
        await websocket.send_json(data)
        await asyncio.sleep(1)  # Adjust based on desired update frequency
@Wytamma Wytamma added v2 and removed v2 labels Mar 15, 2024
@Wytamma
Copy link
Owner Author

Wytamma commented Apr 10, 2024

What will happen if the frontend gets out of sync?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant