emitter-io / emitter

High performance, distributed and low latency publish-subscribe platform.
https://emitter.io
GNU Affero General Public License v3.0
3.83k stars 352 forks source link

Emitter client library for Flutter #217

Closed postacik closed 5 years ago

postacik commented 5 years ago

Hi, I created an emitter client library for Flutter.

You can find the source file in the following link:

https://gist.github.com/postacik/ac238af7e50fdb685551783fc37a4717

And here is a part of the sample code which uses the library:

https://gist.github.com/postacik/2f0685c9f62347f1890f7cdc1b1bd1f8

The library uses Dart mqtt_client library so you have to add it to your dependencies in pubspec.yaml file:

dependencies:
  flutter:
    sdk: flutter
  mqtt_client: ^5.5.2 

I hope it helps other Flutter developers.

postacik commented 5 years ago

I'll try to implement a simple WhatsApp clone using Flutter and Emitter.

As far as I can understand Emitter users have no interest in Google Flutter :)

Florimond commented 5 years ago

Thank you for your contribution!

I don't know Flutter at all, but a demo would be great, that's for sure.

However, I'm wondering how you would solve the problem of push notification. I don't know much about mobile development, but if I understand correctly, you have to go through Google servers (in the case of Android) for push messages. See issue 91.

postacik commented 5 years ago

Yes you're right.

The server application must have a logic to send a push notification to wake up a client, if a message that targets that client is published and the client is not alive.

When the client wakes up, it has to resubscribe to its channels.

And all the messages have to have a TTL so that they will be delivered to non-alive clients successfully.

Google Firebase Cloud Messaging (FCM) which is free can be used for Android and iOS applications.

postacik commented 5 years ago

Should I close this ticket?

Florimond commented 5 years ago

I have created a dart repo for you here: https://github.com/emitter-io/dart

postacik commented 5 years ago

Thanks. I'll add the dart file and a read.me to the repo.