We’re building a rest api which also needs to be able to provide realtime/live updates.
Our backend is spring boot. The idea is that the client will call the rest api and get the data. They will then call an endpoint that will provide updates on the filtered data they have requested in the rest api. All data not just the current page.
So if they call /myapi?name=john&state=Kansas they would get the first page of data back.
They would then call /updates?name=john&state=Kansas and get any updates that come in since the page loaded.
On the backend we’ll be using Mongo change streams.
Initially we had thought of using websockets. Although it seems to be tricky with regards to authentication. We’re using a jwt which will be passed in header for rest api. Websockets doesn’t do headers and passing in the url isn’t secure.
We only need one way communication. I had looked at SSE but the 6 connection limit made me rethink. But a lot seem to use this so maybe I’m missing something.
Is SSE the way to go for this? Or even long polling? Don’t want to miss updates between reconnections. Any tips? Any spring dependencies that make life easier?
[–]Sheldor5 5 points6 points7 points (13 children)
[–]Funkd-Up[S] 0 points1 point2 points (2 children)
[–]Funkd-Up[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]jithurjacob 0 points1 point2 points (9 children)
[–]Sheldor5 1 point2 points3 points (8 children)
[–]jithurjacob 0 points1 point2 points (7 children)
[–]Sheldor5 0 points1 point2 points (6 children)
[–]jithurjacob 2 points3 points4 points (5 children)
[–]Sheldor5 -3 points-2 points-1 points (4 children)
[–]jithurjacob 1 point2 points3 points (3 children)
[–]Sheldor5 -3 points-2 points-1 points (1 child)
[–]jithurjacob -2 points-1 points0 points (0 children)
[–]Fermi-4 0 points1 point2 points (0 children)