HomeX-It / pusher-websocket-flutter

An unofficial Flutter plugin that wraps pusher-websocket-java on Android and pusher-websocket-swift on iOS
MIT License
30 stars 22 forks source link

Private channel #15

Closed putheng closed 4 years ago

putheng commented 4 years ago

Hi, How to broadcast to private channel?

MisterJimson commented 4 years ago

You can subscribe to a private channel to listen to events, but we haven't yet added support to send events.

putheng commented 4 years ago

Hi thank you for clarifying, But how to listen to a private channel? I can not find method in the example code. I see only Pusher.subscribe() So which method would you prefer?

Again thank you to this package help me complete a project for a client easily and on time Thank you so much.

MisterJimson commented 4 years ago

When calling Pusher.init send PusherOptions with PusherAuth setup for authentication. This is required for private channels.

Then just call Pusher.subscribe as normal with the channel name as private-mychannel.

See the official Java docs for more info: https://github.com/pusher/pusher-websocket-java#private-channels

MisterJimson commented 4 years ago

@putheng are you stilling having issues with private channels or did my comment help you solve the issue?

putheng commented 4 years ago

No, I solved it. Thank you