I'm trying to build my own chat frontend for the Rocket.Chat Live Chat. But currently I have the problem, that I can't subscribe to a live chat room for listening.
1) RealtimeAPI: I connect to the the rocket.chat webservice
2) RealtimeAPI: I register the guest user with "livechat:registerGuest"
3) Rest API: I create a room with "/api/v1/livechat/room?token="
I get this as answer:
{ room:
{ _id: '43TJpc3q9eRjqhFXW',
msgs: 1,
usersCount: 2,
lm: '2020-05-26T13:29:21.965Z',
fname: 'jxkyZ72fFneYCMNnM',
t: 'l',
ts: '2020-05-26T13:29:21.965Z',
departmentId: '2DKbAHmjxHtEL8g3n',
v:
{ _id: 'D6B7wJ7kcFb2QmR2u',
username: 'guest-83',
token: 'jxkyZ72fFneYCMNnM',
status: 'online' },
cl: false,
open: true,
waitingResponse: true,
_updatedAt: '2020-05-26T13:29:22.047Z',
servedBy:
{ _id: 'irByyRx98ii4wjGmj',
username: 'Admin',
ts: '2020-05-26T13:29:22.019Z' } },
newRoom: true,
success: true }
I use this _id: '43TJpc3q9eRjqhFXW'
value for the subscription room name, all others cause "invalid event"
4) I try to subscribe to "stream-room-messages" and to "stream-livechat-room", but for both I receive only {"msg":"nosub","id":"3"}
and not something like this
{
"msg":"ready",
"subs":[
"43TJpc3q9eRjqhFXW"
]
}
And I receive no messages from the live chat room.
Can someone tell me what I'm doing wrong or what is missing?
Thanks in advance Frank