agsxmpp event order - agsxmpp

Have a problem with agsXMPP. What I want to do, is connect to openfire server as "User1" (as example), check which users in my roster are online and return collection of ONLINE usernames.
The problem is, that OnPresence event is the last event (based on my research), and it occures for each online user. But how can I know when it has finished checking all the online users, so I could finally return my ONLINE collection?
Is there something like OnPresenceEnd event?
Please help!

no there is nothing like that. The xmpp server sends every presence in its own stanza. And there is nothing in the XMPP protocol which would tell you that all initial presences are received now.
XMPP is an asynchronous protocol. When possible keep your code also asynchronous and update the presence after each OnPresence event.

xcc.OnRosterItem += new agsXMPP.XmppClientConnection.RosterHandler(method_name1);
xcc.OnRosterEnd += new ObjectHandler( method_name2); <---This is what you need

Related

XMPP: How to query specific rosters presence

Whats is XAMP stanza for get specific(single or multiple) roster presence instead of all ?
I'm using Strophe.js for XAMPP(openfire) communication. As per Openfire didn't provide support for message status(read, received and read) at server side so, I have implemented some extra logic for make it work.
I'm retrieving my rosters by ajax call through querying Openfire db one self and returning rosters, also roster search functionality here. Problem is when I search and get roster through API so I can't get presence of roster. I want presence only for search result rosters instead all users through Strophe.js(XAMP stanza).
I found a partial solution, it's only working when the roster is online. we can take default user status offline and we can update online presence response.
<presence to="JID" type="probe" xmlns="jabber:client"/>

How can the recipient be informed that someone has blocked them on ejabberd?

We are building a chat app using latest ejabberd and there is a use case where user A blocks user B. the requirement is to hide last seen or user's presence from each other. if A blocks B then its easy to hide these information from user A but how can user B be informed that user A has blocked them ? whats the best approach to tell user B the someone has blocked them on realtime while both are in a conversation , like whatsapp does now.
For presence, you do not have to use block, you can simply remove contacts from roster. That way, the other user is notified and can also stop sharing his presence.
There is XEP-0191: Simple Communications Blocking:
https://xmpp.org/extensions/xep-0191.html
https://xmpp.org/extensions/attic/xep-0191-0.2.html
I think it will give you the answers you need. Now it depends how will you implement this functionality using chosen client library like Smack.

SignalR Core Check if users are connected

I know that in the old SignalR days that this wasn't possible so you were forced to keep a list of clients that were connected even though it obviously existed.
I'm hoping there is a way to pass an array of user ids (that signalR should be able to match from the authentication claims of users) and have it tell me which ones are online and which are not. The reason why is that we want to send an email if they're not online to receive notifications.
So easy question: Is there a way to get the users that are currently connected?
Nope, there's nothing built in for this

Yii2 notification system implementation

I am trying to implement simple notification system in Yii2.
I have a list of Records populated in ListView.
I would like to allow users to vote for this records. Only once per Record.
Also the Author of each record must be notified (smth like new incoming emails) about who voted for his Record.
What is the easiest way to implement this in Yii2?
Thanks for an advice!
With php only you can't do that, you need to have js at some point.
Solution One could be, from user B side you keep asking the server after certain time (using ajax), if anything(event) happened. If it does return the result with that ajax and update the page.
But then again this is not a very good practice.
If you really want a Real Time update, you might want to use socket.io. Then again using php socket is a bad idea.
So here comes the Solution Two: yii2 + redis + nodejs + socket
redis will do the communication between yii2 and nodejs. The idea is, if anything (event or update) happens yii2 will publish a event with associate data to redis channel and nodejs which is listening to that channel will catch that event and send the data (or update) to client using socket.
Here is a real time chat application tutorial using yii2+redis+nodejs+socket.

GAE channel API chat

Currently im trouble shooting some code that I wrote to create a chat room. I will include the code if necessary but for now I just wanted to hear some possibilities for the problem im having. So basically I have client1 that is listening to a channel and then when clien2 sends a message to the server the message is then sent from the server to all available users. What is happening is that client 2 will send the message and it will be displayed on his browser but client 1 will not receive the message until he refreshes the page or types in a message of his own. So I would think that user presence is being detected fine since the message eventually gets sent to all available users but im not sure? Thoughts?
The Google App Engine blog has a nice case study that talks about how to do this.
They store a list of channel ID's in memcache and send update messages to each of them. They mention that race conditions make memcache not ideal, but it worked well enough for their demo.