braverhealth / phoenix-socket-dart

Cross-platform and stream-based implementation of Phoenix Sockets
https://pub.dev/packages/phoenix_socket
BSD 3-Clause "New" or "Revised" License
73 stars 37 forks source link

continuously listen on a topic? #82

Closed mihailacusteanu closed 3 months ago

mihailacusteanu commented 3 months ago

How can I continuously listen to a topic? This type of code works fine when I already have messages in the queue, but If after the initial call of this code if I receive other messages, the messages don't get processes.

await for (var message in channel1.messages) {
// message processing
}

Is this the way the library should work? I am missing something? should the code live in a special object? I haven't touched OOP in a while and I am new to flutter/dart. Thank you!