Open th0mas opened 4 years ago
@th0mas see how far you can get with phoenix_wings
and leave comments on this issue with your progress.
If you hit a brick wall, please open an issue on https://github.com/mfeckie/phoenix_wings/issues and link to it from here.
Groking the source will be informative if you decide to re-implement it.
phoenix_wings
should work well. I can't see any large feature difference between that and the reference phoenix.js
implementation. If we do find one, I'm sure it will be easily patched.
Crucially we need to have a library that knows to avoid attempting to reconnect when the devices is offline and automatically reconnects when there is a connection, so it may need to be aware of connection status #3. Also, having a heartbeat could be useful for presence https://github.com/mfeckie/phoenix_wings/issues/10 as we want to know "Who's Online?"
This library does seem to have Presence support (https://pub.dev/documentation/phoenix_wings/latest/html/PhoenixPresence-class.html) so that shouldn't be a problem.
I'll check for online/offline callbacks.
Just had a look at the phoenix_wings
repository, the last updated was a while ago now:
With the newest version of Phoenix I'm not sure if this library is still compatible.
@SimonLab yeah, the top result when searching for google.com/search?q=flutter+phoenix+channels
Is no longer phoenix_wings
...
It's phoenix_socket
: https://pub.dev/packages/phoenix_socket
Which has recent activity/contribution: https://github.com/braverhealth/phoenix-socket-dart
It has a "corporate sponsor" in the form of: https://braver.net/en/
And the lead dev @matehat seems to know what he's doing. 👌
This is the approach/route I would take. ðŸ’
Quick issue https://github.com/braverhealth/phoenix-socket-dart/issues/ and PR to test https://github.com/braverhealth/phoenix-socket-dart/pull/57 receptiveness to future contributions. 😉
Is there any issue? I wonder if anyone using it in production one of those libraries?
Flutter/Dart currently only has one Phoenix client library so we have two approaches to integrate Flutter and Phoenix:
Use the existing library: https://github.com/mfeckie/phoenix_wings This is probably the easiest option, but we will run into some bugs/edge cases, such as heartbeat
ack
s that aren't implemented by this library so we may have to make changes anyway.Run our own on top of Darts web_socket_channel phoenix.js
cloc
s in at around 800 lines of OO JavaScript code, so it wouldn't be a huge task to port this over to dart. This would provide us with a consistent API with the official library. I'm happy to do this as a "learn dart" exercise