Backend sending realtime message:
const channel = { name: "uploadStatus", resourceId: instanceId };
console.log("Backend sending to: ");
console.log(channel);
site.publish(channel, "Stay tuned for new recipes!")
.then(() => {
console.log("Published");
}).catch((e) => {
console.log("Error");
console.log(e);
});
And dashboard code to subscribe:
const channel = { name: "uploadStatus", resourceId: instance.instanceId };
realtime
.subscribe(channel, (message, channel) => {
let payload = message.payload;
console.log("Payload");
console.log(payload);
let channelName = channel.name;
console.log("Channel", channel.name);
if (message.publisher) {
let publisherId = message.publisher.id;
console.log(publisherId);
}
})
.then((id) => {
console.log("Subscription ID");
console.log(id);
});
Has anyone used realtime api npm package in blocks?
By the way I got this same error when using velo api as well so if anyone has used realtime in blocks using velo apis as well, do you know what can cause this error?