Hi, i’ve a problem in realtime api with the subscription to stream-notify-room.
If I try to subscribe to ‘typing’ (an event of stream-notify-room) I receive a ‘nosub’ answer instead of ‘ready’ and therefore I don’t receive notifications about typing.
The user that attempts to subscribe has all permission ( Administration→Permissions).
What do I do wrong? Thanks
Server Setup Information
Version of Rocket.Chat Server: 3.15.0
Operating System: Ubuntu 20.04.2
Deployment Method: snap
Number of Running Instances: 1
DB Replicaset Oplog: Enabled
NodeJS Version: 12.22.1
MongoDB Version: 3.6.14
Proxy: nginx
Firewalls involved: none
import crypto = require('crypto');
import DDP = require("ddp");
import login = require("ddp-login");
const serverPort = ...;
const serverHost = "...";
process.env.METEOR_TOKEN = '...';
const visitorToken = '...';
const secret = '...';
const roomId = crypto.createHmac('sha256', secret).update(Math.random().toString()).digest('hex').substring(0, 17);
const msgId = crypto.createHmac('sha256', secret).update(Math.random().toString()).digest('hex');
const ddpClient = new DDP({
host: serverHost,
port: serverPort,
maintainCollections: true
});
ddpClient.connect(function(err) {
if (err) throw err;
login(ddpClient, {
env: "METEOR_TOKEN",
method: "token",
retry: 5
},
async (error, userInfo) => {
if (error) { ... }
else {
await new Promise((resolve, reject) => {
ddpClient.call(
'livechat:registerGuest', [{
token: visitorToken,
name: "...",
email: "...",
department: "..." }],
(error, result) => {
if (error) { return reject(); }
resolve(result);
});
});
await new Promise((resolve, reject) => {
ddpClient.call(
'sendMessageLivechat', [{
_id: msgId,
rid: roomId,
msg: "...",
token: visitorToken }],
(error, result) => {
if (error) { return reject(); }
resolve(result);
});
});
ddpClient.subscribe("stream-notify-room", [roomId+"/typing", false], () => { ... } );
}
});
});
ddpClient.socket.on('message', (msg) => {
const data = JSON.parse(msg.data);
console.log(data);
});```