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

How to triggering events #13

Closed putheng closed 4 years ago

putheng commented 4 years ago

How to triggering events to Pusher server and broadcast to a channel that subscriber subscribes to ?

LtotheWT commented 4 years ago

hey @putheng did u manage to trigger event ?

MisterJimson commented 4 years ago

You can use the Pusher debug console to test sending events: https://dashboard.pusher.com/

Select your app at the bottom of that screen.

LtotheWT commented 4 years ago

@MisterJimson thx for ur reply, but could this plugin can do something like pusher.trigger([channel],event,data) ?

MisterJimson commented 4 years ago

@LtotheWT it would be possible, but typically the client side SDK listens to events, and the server side SDK sends events. You should be triggering events from your backend, not a client side device.

josh-burton commented 4 years ago

I was very surprised to find this library doesn't allow triggering events. Would be quite a common use case.

MisterJimson commented 4 years ago

@athornz I can understand that assumption, but Pusher is designed to have events triggered by your backend.

One reason would be your Pusher secret. The "secret" is only used when triggering events on the server, where as you use your app "key" on the client side. If you include the secret oon the client side then someone else can get access to it and trigger events on your account.