-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Make a database query returning a stream of results, as opposed to current implementation that returns an all-in-one in-memory array.
Original description
I'm not very experimented with loopback yet but I tried to investigate various methods for the ability to stream the result of a simple query from a client (instead of sending the result over http).
I found that
- strong remoting is able to stream data (only files?), but it's not really what I'm looking at.
- LiveSet / change-stream would be in some way what I'm looking at, but unfortunately LiveSet is only a subscription to a model which react to changes over time (create/update/...), however it will not react to any get request from the client.
- PubSub is not either what I'm looking at. PubSub is more for e.g. a real-time chat.
- Socket.io example. I'm a bit confused with this one, but it feels like an example of using PubSub with socket.io?
Did I miss anything else, or does loopback not yet support this feature and I'm potentially left with the implementation myself?
Just to highlight my use case: I have currently an Express.js app working on Heroku that I'm trying to rewrite on Loopback. Heroku has a 30s timeout out of the box (hard limit) and my application is fetching potentially 10s of thousands of records so that some requests may take longer than 30s to respond. Simple solution to avoid the timeout is to stream the result over sockets - it's also more user friendly since the user is able to see the loading going on.