Closed rahulrmishra closed 3 years ago
We cannot guarantee that you will receive a message that is sent before you subscribe. You can use the subscription.whenStarts
promise to figure out when a subscription is set up properly so you can start sending messages tho.
Hello, I have an issue where if I send a message to channel which is not created yet and then subscribe to it then I don't get the message which I had sent. I use this -> pubnub: ^4.0.0-beta.1
In the earlier vesion -> pubnub: ^3.2.0, I used to get the message which I had sent
These are the logs --->
If I send this message to channel (Which is not created yet) Message ==> {channelID: CHANNELID, channelMsg: true, msgType: text, text: Hello, uuid: UUID}
And then subscribe to it immediately these are the only messages that I recieve after immediately subscribing to that channel. ---> {source: objects, version: 2.0, event: set, type: membership, data: {channel: {id: CHANNELID}, custom: {clearChatTimeToken: 16323101227810000, lastMessage: Hello, lastMessageType: text, lastMsgTimeToken: 16323101315670000, lastReadTimeToken: 16323101315680000, receiverUUID: UUID}}}
{source: objects, version: 2.0, event: set, type: membership, data: {channel: {id: CHANNELID}, custom: {lastMessage: Hello, lastMessageType: text, lastMsgTimeToken: 16323101315670000, receiverUUID: UUID}, uuid: {id: UUID}}}
If I send a message to a channel which I am already subscribed to, then these are the logs ->
Message ==>
{channelID: CHANNELID, channelMsg: true, msgType: text, text: Already subscribed, uuid: UUID}
Recieved messages (Listened by listener) {source: objects, version: 2.0, event: set, type: membership, data: {channel: {id: CHANNELID}, custom: {clearChatTimeToken: 16323042591580000, lastMessage: Already subscribed, lastMessageType: text, lastMsgTimeToken: 16323116797790000, lastReadTimeToken: 16323116797800000, receiverUUID: UUID}, uuid: {id: UUID}}} {source: objects, version: 2.0, event: set, type: membership, data: {channel: {id: CHANNELID}, custom: {clearChatTimeToken: 16323042591580000, lastMessage: Already subscribed, lastMessageType: text, lastMsgTimeToken: 16323116797790000, lastReadTimeToken: 16323075006560000, receiverUUID: UUID}, uuid: {id: UUID}}}