I want to create a new subscription e.g (stream-all-messages
) in Rocket Chat same as stream-room-messages
which is already present in docs.
I am using DDP listener to test it, following are the examples which I am trying.
// Subscribe to a message stream from a channel or group
console.log("Attempting to subscribe to the Group/Channel now.\n");
ddpClient.subscribe("stream-room-messages", [RoomId, false], function() {
console.log(ddpClient.collections);
console.log("Subscription Complete.\n");
// Display the stream on console so we can see its working
console.log("\nStarting live-stream of messages.:\n");
ddpClient.on("message", function(msg) {
console.log("Subscription Msg: " + msg);
});
});
above example works because stream-room-messages
already present but when I try to execute the following it raises an error i.e.
Subscription Msg: {"msg":"nosub","id":"2","error":{"isClientSafe":true,"error":404,"reason":"Subscription 'stream-only-messages' not found","message":"Subscription 'stream-all-messages' not found [404]","errorType":"Meteor.Error"}}
when I call this
// Subscribe to a message stream from a channel or group
console.log("Attempting to subscribe to the Group/Channel now.\n");
ddpClient.subscribe("stream-all-messages", [RoomId, false], function() {
console.log(ddpClient.collections);
console.log("Subscription Complete.\n");
// Display the stream on console so we can see its working
console.log("\nStarting live-stream of messages.:\n");
ddpClient.on("message", function(msg) {
console.log("Subscription Msg: " + msg);
});
});
Please help me out how can I add a new subscription.