question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[QUESTION] Delivering real time JSON packages to clients on events

See original GitHub issue

First check

  • I used the GitHub search to find a similar issue and didn’t find it.
  • I searched the FastAPI documentation, with the integrated search.
  • I already searched in Google “How to X in FastAPI” and didn’t find any information.

Description

I have to deliver JSON packages to clients when specific events happens. I imagine building a FastAPI application where people can subscribe and add some callback. Is this the industry-standard of doing things (and is this the right place to look)? I imagine some /subscribe POST with callback instructions and /unsubscribe.

Alternatively I could require people to set up some kind of server to receive the data of course and then HTTP POST e.g.

If this question is out of scope here then please let me know and just close the question. Thank you.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
dbantycommented, Jun 5, 2020

@mr-bjerre a common pattern (and then one I’ve followed in a few places) is to use the web sockets for very basic information only. Not sure how your schema is set up, but let’s say each new piece of news has some unique ID that users can use to pull from a normal FastAPI endpoint. You could, on publish, push just that new ID to clients via websocket. Then, the client could fetch the full details (with all the glory of the OpenAPI schema) with a normal HTTP call.

I’ve only used SocketIO, which utilizes websockets but also allows for long polling for older clients. It has some additional features that make sending/receiving events easy.

One other thing you might consider is using GraphQL instead of REST. GraphQL has a concept of subscriptions I believe (though I’ve never actually used them) and is supported fairly well on Starlette.

Either way I don’t think FastAPI itself will solve your real time problem

2reactions
NixBikscommented, Apr 29, 2020

Ha sorry I don’t know why I thought he answered.

Thank you retnikt! 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSON Event - Qualtrics
First, you will need to create a workflow. · Make sure you're in the Your workflows tab. · Click Create a workflow. ·...
Read more >
Real-time push and events — Zulip 7.0-dev+git documentation
Zulip's event delivery system is based on “long-polling”; basically clients make GET /json/events calls to the server, and the server doesn't respond to...
Read more >
Use incoming webhooks to get real-time updates - Stripe
A webhook enables Stripe to push real-time notifications to your app. Stripe uses HTTPS to send these notifications to your app as a...
Read more >
Adobe I/O Events Frequently Asked Questions (FAQ)
What is the guarantee of events delivery? ... Adobe I/O Events provides durable delivery. It delivers each event at least once for each...
Read more >
API Reference | Eventbrite Platform
Eventbrite brings people together through live experiences. Discover events that match your passions, or create your own with online ticketing tools.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found