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

How to check event name from incoming Message ? #27

Closed freewebwithme closed 3 years ago

freewebwithme commented 3 years ago

How can I check event name from Channel.messages? Message has event property but can't do something like this

if(message.event == "new_order")
matehat commented 3 years ago

You can do:

if (message.event.value == 'foo') {

}
freewebwithme commented 3 years ago

oh nice! Thank you!

matehat commented 3 years ago

No problem! If you have more questions, feel free to ask them through the discussion section!