Which is the best solution for nearby connection cross platform in flutter?

1.7k views Asked by At

I am developing an application in flutter where people in the vicinity can connect to each other in a single room and exchange messages. The app should work like this:

  • A user creates the room (Advertiser)
  • All other users (Browser) connect to the advertiser.
  • Once connected, you exchange messages passing through the advertiser.

The perfect package to do this is google connect nearby: https://pub.dev/packages/flutter_nearby_connections

But it only works between android-android and ios-ios, it is not cross platform.

Now I have also thought of a solution that used the package with bluetooth, but I don't think it is possible to make ONLY the Advertiser user show himself to the others, avoiding that during the search everyone is seen and not knowing who to connect to.

If anyone has any advice for the realization of such a cross platform structure, (avoiding databases) it would be of great help!

Thank you!

1

There are 1 answers

1
Aneesh On

Well you don’t really get many choices if you’re not all connected to the same network. If you are, use pub.dev/packages/bonsoir for discovery and HttpServer and HttpClient in dart:io for communication.

If you’re not connected to the same network, you will need to use BT LE. No other way to do this (that I know of, I’m sure someone much smarter than me knows a way :P)