Pusher widget performance - Mendix Forum

Pusher widget performance

17

Hi,

I like the pusher widget a lot. It helps us keeping the client sessions up to date.

When I look at the network activity in the browser there is a get request to https://<your-server>.mendixcloud.com/rest/pusher/key.

The response is your pusher key (not the secret) and the cluster. This request is done every time a page with a Listen widget is loaded.

For us a least, who uses listen widgets on a lot of pages, it seems wasteful to ask for the same thing over and over again.

Can the key be fetched once and stored in the session somehow?

Could the listen widget perhaps have a “standard key” and then if someone uses multiple ones the extra one can be specified in these cases?

Kind regards

Johan

asked
4 answers

Hi Andreis,

We are using Mendix 8. It seems like it would be nice to have it provided in the layout.

Kind regards

Johan

Created

Hi Johan,

It make sens to cache the value, this issue can be fixed inside the widget…  a pull request can be made...

https://github.com/mendixlabs/pusher-notify-listen/blob/master/src/Pusher/widget/Listen.ts#L112

Alternatively you could make one, pusher widget in the layout.

Maybe if you are on Mendix 8… they have introduce client side constants. This would be a better solution than an API call. But it will require a re-write  to a pluggable widget, it can use an expression. https://docs.mendix.com/apidocs-mxsdk/apidocs/property-types-pluggable-widgets#expression

Cheers, Andries

Created

Hi Wilfried,

Actually we already have one there to know if the user have received new notifications.

Using the one in the layout makes us lose one of the big benefits for us though. I like that I can listen to specific objects so that we get/handle only contextual updates. Maybe we are using it incorrectly but it at least feels like it gives us the possibility to update smaller and more precise bits of information in the client without having massive microflows trying to figure out where the user are.

Kind regards

Johan

Created

Hi Johan, what we did was to move the listen widget to the layout page. Is that an option for you or?

Created