Feature request: expose API endpoint for online presence #525
Replies: 3 comments 4 replies
-
|
Hey, could you please comment in this thread that my comment above is not spam? After posting it, a Github bot has immediately flagged my user as spammy, and I am having trouble contacting a human to undo that. Apparently, having an issue closed immediately after it is created is a giant red flag for the Github spam service. |
Beta Was this translation helpful? Give feedback.
-
|
not spam |
Beta Was this translation helpful? Give feedback.
-
|
I like the idea from this proposal 👍 One thing that potentially stands out is that in PowerSync Cloud, we could have more than one instance serving oplog data to users due to autoscaling. We already have a layer that could forward this request to all instances and aggregate results, but if you call this endpoint for every new chat message I assume it could turn into a fair bit of overhead.
You would unconditionally store the row in the database, right? A potentially related approach might be to add some kind of webhook mechanism to PowerSync to trigger actions on sync events. Being able to sync apps in the background is not an uncommon request, and this could be used to "wake up" clients by letting your backend trigger a push notification. To me at least, that potentially feels more like a "sync first" approach instead of forcing you to proactively check if a user is online to deal with that. There are definitely some efficiency concerns with this as well, each streaming connection to PowerSync is relatively expensive and this adds one per user even if offline. But perhaps there could be an endpoint to register webhooks that would take a user's JWT along with subscriptions. And then when a bucket covered by that request changes, the service would invoke the webhook to let your backend send a notification. We would have to look at ways to make that scale as well and that might impact how easy it would be to use that, but I wanted to share that idea in case it helps with this discussion. |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Hi there,
In my company, we're leveraging PowerSync to build a real-time chat app, and one challenge we're facing is figuring out when a given user (session) is online or not. We're evaluating some options for that, but it would be very handy if we could make an API call to the PowerSync service to ask if a user (session) is online. Better yet, we could pass an array of IDs, and it could tell us which of them are currently online.
This way, our backend could decide based on that info whether to store a row in a database and wait for PowerSync to send it, or send a push notification instead. This presence API doesn't have to be 100% accurate; a best-effort thing would be enough, where an ok means the user (session) was online recently, even though they might have closed the app a few seconds ago.
I imagine the PowerSync service already has that info stored somewhere, so why not expose it and avoid the need to add another dependency just for that, right?
Beta Was this translation helpful? Give feedback.
All reactions