Project

General

Profile

Will Tigase-Http-API Support Presence like Packet (Subscribe a Buddy)?

Angelo Chen
Added over 5 years ago

Hi Team,

From tigase-http-api, end user can query/update auth and user data via Rest such as list user, update password, get roster, execute adhoc etc, but how about the user action related packet,

for example subscribe a friend by the sent packet

<presence type="subscribe" from=''angelo@tigase.org" to="jack@tigase.org"/>

or message to somebody?

If I'm correct after the presence packet deliver to session manager, it will be treated as a broken packet and be ignored.

Will tigase-http-api support presence subscribe/subscribed or message?

What's the solution when subscribe by http?


Replies (6)

Added by Andrzej Wójcik IoT 1 CloudTigaseTeam over 5 years ago

Tigase HTTP API allows to send packet from/to anyone, it means this presence packet with type subscribe could be properly delivered to jack@tigase.org but local instance of SessionManager would not know about this packet, as it will not be processed by session manager.

The best approach to manager user subscriptions by HTTP API would be to execute adhoc commands from SessionManager by calling them thru HTTP API and allow this adhoc commands to properly update subscriptions.

As for sending message, you can send message in this way, but this message would not be processed by SessionManager, but it should be delivered to recipient ok. The only issue would be that is message is not processed by session manager so it would not be processed locally by message archiving and other features, which are implemented in session manager.

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam over 5 years ago

I think any packet (presence or message) will be eventually processed by SessionManager on behalf of the receiving user. It will not be processed on behalf of the sender (from address) which might be an issue for subscription packets. For messages it might be good enough.

As Andrzej suggested, I recommend to us tigase-http-api to modify user's roster directly rather than using presence subscription mechanism.

Added by Angelo Chen over 5 years ago

Yes, any packet eventually delivered to session manager and processed by session manager on behalf of the receiving user. After i investigate the code, if angelo subscribe Jack where Jack is online, in order to presence plugin process successfully, the packet should be

<presence xmlns="jabber:client" type="subscribe" from=''angelo@tigase.org" to="jack@tigase.org"/>

nor

<presence type="subscribe" from=''angelo@tigase.org" to="jack@tigase.org"/>

However when Jack is offline, the packet will be treated as a broken packet which verified in the method isBrokenPacket(Packet p) in SessionManager. The same presentation as the message packet.

If use tigase-http-api to directly modify user's roster directly rather than using presence subscription, if Angelo want to subscribe Jack, how to notify Jack he want to presence subscribe?

Will the best approach be use tigase http api to trigger the adhoc command which produce out the presence subscribe packet to be processed by session manager?

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam over 5 years ago

Actually, why do you want to do it rather then sending XMPP packets normally form a user to a user?

Looks like we are focusing here on solving a solution rather than a problem. Please describe your problem to us and we can suggest the best approach and solution to it.

Added by Angelo Chen over 5 years ago

Thanks Artur.

The requirement is subscribe/confirm/reject a buddy through http regardless of user is online or offline on tigase server, also regardless of this buddy is online or offline on tigase server.

Chat via tigase is one subsystem in the platform, and in game integration is another part. User in game can retrieve roster(including pedding) regardless of user login in tigase, then subscribe/confirm/reject can be done through http. Also user can update his rich presence which contains his achievement in the game to his buddies.

We ever achieved the rich presence broadcasting to his buddies in game no matter user is online or offline on tigase server through http before tigase http api arise by embed a jetty server in tigase server and inject the SessionManager into handler. Once SessionManager got, any packet can be delivered out.

what's the solution to this?

Thanks,

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam over 5 years ago

I have responded via email.

    (1-6/6)