XMPP ( with smack) - Adding Friend

2019-05-30 06:05发布

In my chat application when I have to add a friend I have to follow this process -

Suppose A->B ist : A will send subscribe packet to B ( server entry shows NONE subscription ) iind - B will send subscribed packet to A ( server entry will be - TO/FROM) iiird - B will again send subscribe packet to A ( server entry TO/FROM ) ivth - A will send subscribed packet to B ( server entry BOTH )

Each time a notification is sent to the concerned user and after allowing corresponding packet is sent.

I want to do it like this -

When A sends a friend request to B ( a notification To B will be sent - and the server entry should be TO/FROM ) and its upto B to accept or not, If he accepts it then immediately the server entry should be BOTH.

Please tell me how can I achieve the same by sending only two sets of subscription packets.

Thanks

2条回答
Evening l夕情丶
2楼-- · 2019-05-30 06:25

AFAIK this can only be done on the client/library level: You have to implement the client so that for every confirmed subscription request, another subscription request is send back to the initial requester.

But you will always have 4 steps/packets to be send to "friend" to JIDs.

查看更多
老娘就宠你
3楼-- · 2019-05-30 06:36

This would be implemented according to the appropriate specification, so it doesn't make sense to try and change it.

This is not Smack defined behaviour, it is XMPP specification defined behaviour.

查看更多
登录 后发表回答