@julian Thanks for getting back to me quickly. Other priorities pulled me away from this, but after looking at your response, it seems like what I'm actually after are "unread" counts, not just notifications. The simple GET solution returned notifications, but not every "unread". Our app is using the session sharing plugin, and we are associating NodeBB accounts with our app accounts. Would I be able to leverage some of the session sharing functionality to get an unread count for users on our app based on their NodeBB account? Thanks
How to get Chat Name from Websocket?
-
It looks like this is the websocket method i want to call, but i can't seem to get a response out of it....
i/ve tried
socket.emit('modules.chats.getRoomData', 1576, function(){console.log(arguments)})
in chrome's console and gotten nothing, even though room 1576 shows up when i executesocket.emit('modules.chats.getRecentChats', {after:0}, function(){console.log(arguments)})
Can someone point me in the right direction here?
-
Not all methods are available to sockets. Try
socket.emit('modules.chats.loadRoom', {roomId: 1576}, callback);
You won't be able to get any data if the user making the call is not in the room.
-
@baris said in How to get Chat Name from Websocket?:
Not all methods are available to sockets
ah. that brings me to my next questio..... oh nevermind. loadRooms does give me the users in the room.
@baris said in How to get Chat Name from Websocket?:
socket.emit('modules.chats.loadRoom', {roomId: 1576}, callback);
got it!
and that's got the data i wanted.
now to figure out if there's a way to load a chat message by message id, or if that's just going to have to be a "you need to iterate through the chats for that" thing.
you wouldn't happen to know that one off the top of your head would you? :cute_fox_eyes:
@baris said in How to get Chat Name from Websocket?:
You won't be able to get any data if the user making the call is not in the room.
that's fine. it gives me an error on a "bad" room which is what i want anyway.
-
There is a method to get the raw content of a message by its message id but there is no method to load all the data of a message yet.
-
@baris said in How to get Chat Name from Websocket?:
There is a method to get the raw content of a message by its message id
interestingly so does sockbot although i recon the two different methods serve rather different purposes.
@baris said in How to get Chat Name from Websocket?:
there is no method to load all the data of a message yet.
ah. trhen my interface shall throw E_UNSUPPORTED for now until a certain vixen makes a PR to fix that.