Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
rajar101 #1
Member since May 2016 · 5 posts
Group memberships: Members
Show profile · Link to this post
Subject: How to get Presence status of any user
Hi,

Is it possible to get the the presence status of any user (not only buddies) through MATRIX XMPP SDK?

I know that there is a possibility to get the presence status buddies. But what if the contact is not in roster (or buddy).

I need to create a wcf webservice which will return the presence status of any user logged into Ejabberd. Will I able be able to do this with Matrix XMPP SDk? I can login as admin ( if needed) within WCF.

Regards,
Raja
Avatar
Alex #2
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
You have to check the ejabberd documentation to see if this is possible as admin user with ejabberd.
If there is something in eJabberd then please point us to the documentation and we will know how you can do this with MatriX.

I think this can be done with serice discovery, but it am not sure if it tells you the exact online status.
Why are you not running a bot client and force every user to subscribe to it?

Alex
Avatar
rajar101 #3
Member since May 2016 · 5 posts
Group memberships: Members
Show profile · Link to this post
Hello Alex,

Thanks for your reply.

>> If there is something in eJabberd then please point us to the documentation and we will know how you can do this with MatriX

I found this link has the functionality that i need in ejabberd. Just wanted to know if this can be achieved using Matrix client.
https://www.ejabberd.im/node/757

>>Why are you not running a bot client and force every user to subscribe to it?
Why should we run an additional bot to get the presence status when ejabberd already has that info. If there are 1M users, creating a bot and subscribing to all 1M users from this bot to get presence status seems to be a overkill. Is there any simple method, which when called return the status of any user connected to ejabberd?

Regards,
Raja
Avatar
Alex #4
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
For RPC look and the classes in MatriX in the Matrix.Xmpp.Rpc namespace, and at the Matrix.Xmpp.Client.RpcIq class.
If you have mor specific questions and Xml samples from ejabberd we can help you to build the packets.

I still don't have your complete use case. A bot client would receive any Presence update in realtime as they appear. This should be muc more efficient then polling the server for presences at a given interval.
There are many solutions to solve this requirement.

Alex
Avatar
rajar101 #5
Member since May 2016 · 5 posts
Group memberships: Members
Show profile · Link to this post
Hello Alex,

Thank you for the information. Will look into Matrix.Xmpp.RPC and get back.

I believe bot is nothing but an xmpp client running in server.  You would add all the users as contacts ( or buddies) to this bot. And you would get an event when presence status changes for subscribed users ( buddies). If I have a very huge user base, will it be ok to have all of them as buddies for a single bot?

Also, my use case is little different. There is a server routine which has to run only when the user is logged into ejabberd. This routine first checks whether the user is logged in and then perform its action. If the user is logged off, it skips. This routine runs periodically for all users in ejabberd.


Regards,
Raja
Avatar
Alex #6
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
You want also use directed presences. In this case the bot does not need everyone on the contact list and subscribed. All your users just need to send a direct presence to you bot on login. Then they automatically get all following presence changes.

Having a bot client with a huge contact list should be also no problem.

Alex
Avatar
rajar101 #7
Member since May 2016 · 5 posts
Group memberships: Members
Show profile · Link to this post
Hello Alex,

Thanks for the valuable information.

I tried xmlrpc sample (php) by following the link mentioned below and it works fine.
https://www.ejabberd.im/ejabberd_xmlrpc

I am able to check whether the user is online by sending the "user_resources" command.

May I know how to do the same with Matrix.Xmpp.Rpc?


Regards,
Raja
Avatar
Alex #8
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The page you link to has examples only for HTTP, not for XMPP connections.
Does this ejabberd extension work over HTTP only, or also over XMPP?

Here you can find samples how to build RPC requests with MatriX:
http://forum.ag-software.net/thread/1562-What-is-RPC-mecha…

Alex
Avatar
rajar101 #9
Member since May 2016 · 5 posts
Group memberships: Members
Show profile · Link to this post
Hi,

Not sure whether we can do this over xmpp. But for now, I will go with xml-rpc.net which satisfies my requirement.

Thanks for your support.

Regards,
Raja
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters: