Not receiving PubNub messages when the user is not actively interacting with any channel

97 Views Asked by At

When two clients are subscribed to the same channel, they communicate as expected. However, if I don't perform any kind of activity, such as not sending a new message for an hour, an issue arises. These two old clients can send and receive messages, which is expected. But if I reconnect one of these two old clients or add a new client to the same channel, the old client(s) that were created in the beginning do not receive messages sent by the new client. However, when an old client sends a message, the new client receives all of those messages.

My Client was created with this configuration:

let config = {
    publishKey: pubKey,
    subscribeKey: subKey,
    userId: userId,
    ssl: true,
    presenceTimeout: 300,
    heartbeatInterval: 60,
    heartbeatTimeout: 120,
    keepAlive: true,
    restore: true,
    autoNetworkDetection: true,
    wildcardSubscribe: true,
    leaveOnUnsubscribe: true
};

let client = new PubNub(config);

I was subscribing using this:

client.subscribe({
    channels: ["myChannelName"],
    timeout: 1200
});

I was expecting that the old and new clients should communicate with each other without any issues, as they are connected to the same channel.

But how can I achieve these?

0

There are 0 best solutions below