pubnub / javascript

PubNub JavaScript SDK docs https://www.pubnub.com/docs/sdks/javascript
Other
553 stars 401 forks source link

[FEAT] Auto enable receivePresenceEvents for channels with '-pnpres' suffix #391

Closed roman-rr closed 4 months ago

roman-rr commented 4 months ago

Please review & consider, if possible to automatically enable receivePresenceEvents: true for channels with suffix -pnpres, like so:

// Current usage
const subscriptionSet = pubnub.subscriptionSet({ 
    channels: ['ch1', 'ch2'], 
    subscriptionOptions: { receivePresenceEvents: true } 
});

// Possible variation to reduce code base
const subscriptionSet = pubnub.subscriptionSet({ channels: ['ch1-pnpres', 'ch2-pnpres'] });

And then both cases will have flag receivePresenceEvents: true, which can reduce code double-tube for presence/non-presence channels in client side.

parfeon commented 4 months ago

@roman-rr thanks for reaching out to us.

I'm not really sure what you want to achieve. receivePresenceEvents - this is a flag which internally used to generate -pnpres versions. In first case set will contain: ch1, ch2, ch1-pnpres and ch2-pnpres and on subscribe updates will be received from all of them (real-time messages and presence updates). Second example will only listen for presence updates.

roman-rr commented 4 months ago

@parfeon Thanks, I already find out.