39
Views
11
Comments
[Reactive Pusher Client] Cannot post events
pusher-reactive-client
Reactive icon
Forge asset by Arley Silveira
Application Type
Reactive
Service Studio Version
11.53.39 (Build 61952)

Hi, 

I have been trying to use your client to connect to pusher.com, both from an app and from a reactive web.

The client connects without problems to the channel but I am having when I try to send a message:

Cannot broadcast client event (connection not subscribed to channel private-channel)

Same error when I try your web client demo.

I noticed there are no references in your components of the "secret" parameter I can read on pusher.com=>App Keys

Do I need to use it, and if yes how?

Thanks

  

2023-08-28 07-00-10
Paulo Torres
Champion

I have this implemented and working also with this component: https://www.outsystems.com/forge/component-overview/1493/pusher-com-apis

Only with Reactive Pusher Client I didn't find way to make this working.

UserImage.jpg
Luca Bellintani

Fantastic. Yes, it works perfectly. Many thanks Paulo.

Sending messages is quite easy to achieve with the PusherPublish Server Action. 

I am struggling to understand how to read the messages on the Web server using the Trigger Server action (Pusher_Ext).  How can I loop to wait and process all the incoming messages, without impacting the performance of the webpage?

2023-08-28 07-00-10
Paulo Torres
Champion

Hi Luca,

I'm not sure if I understood your question.

The waiting messages is automatic, you have an action to handle it and this action will do the job.

UserImage.jpg
Luca Bellintani

I think I know what I am doing wrong. The button I created on a page is associated to a Client Action, not to a Server Action. So when I click on the button it runs once and that's it. I still haven't found how to run a Server Action.

2023-08-28 07-00-10
Paulo Torres
Champion
UserImage.jpg
Luca Bellintani

Hi Paulo, this is the very basic POC of the Trigger action.

https://drive.google.com/file/d/1QfpWfVtelpr43usqZ2BohwjDbcULvC43/view?usp=sharing

When you click on the Button it will call the Trigger action, but as you can see, it quits immediately after it read an empty message.

Should I create a loop and wait for a non-empty message?

2023-08-28 07-00-10
Paulo Torres
Champion

Hi Luca,

You are not using the Pusher_Listener from Reactive Pusher Client. Also you need to call PusherPublish on action that will trigger the messages. The action you are using (Trigger) is used inside PusherPublish, so you should use PusherPublish.

In the action to handle the Pusher_OnConnected you have to use GetSocket.

Let me know if you sorted it out!

UserImage.jpg
Luca Bellintani

Hi Paulo, I am confused. In your first reply you stated you could not make Reactive Pusher Client work. You suggested to use Pusher.com APIs which indeed they use secret key and extra variables, necessary to send messages over private channels.

I can indeed send messages to private channels now. 

Pusher.com APIs comes with 2 modules: Pusher and Pusher_Ext.

They contain 2 actions: PusherPublish (which is the one I can use to generate messages) and Trigger, which should be used to read messages.

The challenge I am having is that I do not understand how I can properly implement this action on a web page.

So, just to answer to your last message it is correct I am not using Reactive Pusher Client because it does not work (and you confirmed that). I cannot follow the rest of your comments. You make references to PusherPublish but that action is to post messgaes, not to read messages.

2023-08-28 07-00-10
Paulo Torres
Champion

Hi Luca,

Maybe if I share a demo will be more easier for you.

You need both:

-  Reactive Pusher Client

- Pusher.com APIs 

UserImage.jpg
Luca Bellintani

That would be amazing. I can generate events from a mobile app, no prob with that. What I miss is how to read and react to those event from a web page.

2023-08-28 07-00-10
Paulo Torres
Champion

I'll prepare something for you later on!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.