What?
I'm using a query getRooms
https://docs.pusher.com/chatkit/reference/server-node#get-rooms
this shows every room has an empty member_user_ids
but when I iterate through the users, with getUserRooms
it shows different info.
This is after using your console, and also trying manually to add users to rooms.
Suggested improvements
If a user is in a room, then they should show up in that room when using the API to check room info.
for all rooms you can see the 'lobby' is supposedly empty:
Rabbit all rooms=> [ { created_at: '2019-01-28T06:31:30Z',
created_by_id: 'dcsan',
id: '19398582',
member_user_ids: null,
name: 'lobby',
private: false,
updated_at: '2019-01-28T06:31:30Z' },
{ created_at: '2019-02-15T07:13:27Z',
created_by_id: 'genie',
id: '19408194',
member_user_ids: null,
name: 'testing',
private: false,
updated_at: '2019-02-15T07:13:27Z' },
{ created_at: '2019-02-15T07:17:03Z',
created_by_id: 'genie',
id: '19408196',
member_user_ids: null,
name: 'empty',
private: false,
updated_at: '2019-02-15T07:17:03Z' } ] +302ms
when using a different API and checking a user's rooms, the lobby and other rooms now have members:
Rabbit getUserRooms result=> Promise { <pending> } +1ms
Rabbit userStatus for userId: dcsan +1ms
Rabbit getUserRooms.then res [ { created_at: '2019-01-28T06:31:30Z',
created_by_id: 'dcsan',
id: '19398582',
member_user_ids: [ 'adminBot', 'dcsan', 'genie' ],
name: 'lobby',
private: false,
updated_at: '2019-01-28T06:31:30Z' },
{ created_at: '2019-02-15T07:13:27Z',
created_by_id: 'genie',
id: '19408194',
member_user_ids: [ 'dcsan', 'genie' ],
name: 'testing',
private: false,
updated_at: '2019-02-15T07:13:27Z' },
{ created_at: '2019-02-15T07:17:03Z',
created_by_id: 'genie',
id: '19408196',
member_user_ids: [ 'dcsan', 'genie' ],
name: 'empty',
private: false,
updated_at: '2019-02-15T07:17:03Z' },
{ created_at: '2019-02-15T07:17:10Z',
created_by_id: 'genie',
id: '19408197',
member_user_ids: [ 'genie' ],
name: 'private',
private: true,
updated_at: '2019-02-15T07:17:10Z' } ] +300ms
because of #39 I also tried it both ways:
static async status(userId = 'genie') {
let allRooms = await Rabbit.chatkit.getRooms({})
debug.info('all rooms=>', allRooms)
Rabbit.chatkit.getRooms({})
.then(allRooms => {
debug.info('all rooms=>', allRooms)
})
}
Is there some weird options to the chatkit.getRooms({})
that somehow masks the users in that room?
FWIW I am connecting like this (in my own Class wrapper)
It seems to accept a userId like the client lib, but this does not have any effect.
static async connect() {
Rabbit.chatkit = await new Chatkit.default({
instanceLocator: ChatkitConfig.INSTANCE_LOCATOR,
// userId: userId,
key: ChatkitConfig.SECRET_KEY
})
debug.info('init done')
}
Basically seems that getRooms is not checking and lying on members, always null.
This is a simple bug to fix I guess.