Flutter: Send data from backend to frontend without request

Viewed 406

I am using 3 tools to build my App.

  1. Third party tool
  2. Micronaut / Spring boot
  3. Flutter

Whenever a third party tool sends some data to my Micronaut application, micronaut processes the data and makes some changes as per requirements. Now micronaut will send some data to my frontend application(flutter)

I am very new to Flutter and I know I can get data when I make an API call but my question is that how can micronaut send data to my Flutter App without an API request. I want to send data to my flutter app as soon as micronaut completes processing the data.


This is not specific to micronaut, you can even give me solution for how to do this in spring boot. I just want to know how can I achieve this.

Thanks in advance

1 Answers

To get the desired behaviour you're looking for, you'll need an open connection between your flutter app and the micronaut server.

This can be done with:

  1. Server side push events (SSE).
  2. Websockets

I haven't tried the SSE but websocket connections work well in my experience. A popular websocket client is socket.io although I'm not sure if micronaut supports socket.io.

Related