1

Strophe経由でopenfire(XMPP)サーバーに接続しています。あるユーザーの例-「sat」が別のユーザー「sat1」にサブスクリプションリクエストを依頼した場合。リクエストとレスポンスの変換は次のとおりです。

「sat1」への「sat」リクエスト:-

<body rid="1804705405" xmlns="http://jabber.org/protocol/httpbind" sid="6npq0es11r">
<presence to="sat1@canopus30" type="subscribe" xmlns="jabber:client"></presence>
</body>

サーバーの応答

<body xmlns="http://jabber.org/protocol/httpbind" ack="1804705405">
<iq id="915-56" type="set" to="sat@canopus30/6npq0es11r" xmlns="jabber:client">
<query xmlns="jabber:iq:roster">
<item jid="sat1@canopus30" ask="subscribe" subscription="none"></item>
</query>
</iq>
</body>

ON 反対側「sat1」は、接続時にサーバーから応答を受信しました。

サーバーの応答

<body xmlns="http://jabber.org/protocol/httpbind" ack="1602104745">
<presence to="sat1@canopus30" type="subscribe" from="sat@canopus30" xmlns="jabber:client">
</presence>
</body>

"sat1" は、ユーザー "sat" にサブスクライブ メッセージを送信します。

リクエスト

<body rid="1602104746" xmlns="http://jabber.org/protocol/httpbind" sid="74ijxeuw0">
<presence to="sat@canopus30" type="subscribed" xmlns="jabber:client"></presence>
<iq id="1" from="sat1@canopus30/74ijxeuw0" type="get" xmlns="jabber:client">
<query xmlns="jabber:iq:roster"></query>
</iq>
</body>

サーバーの応答

<body xmlns="http://jabber.org/protocol/httpbind" ack="1602104746">
<iq id="73-58" type="set" to="sat1@canopus30/74ijxeuw0" xmlns="jabber:client">
<query xmlns="jabber:iq:roster">
<item jid="sat@canopus30" subscription="from"></item>
</query>
</iq>
</body>

上記の場合、リクエストを送信したユーザーとリクエストを受信したユーザーのフルネームはわかりません。両方のユーザーエンドの完全な JID を見つけたのは私だけです。リクエストの送受信時にユーザー情報を表示したい。

私が見た多くのチュートリアルでは、名簿上のユーザー情報を取得できますが、名簿上では利用できないユーザー情報も取得できます。

リクエスト

Request :- <body rid="404208005" xmlns="http://jabber.org/protocol/httpbind" sid="5cou8tu8ka">
<iq id="1" from="sat@canopus30/5cou8tu8ka" type="get" xmlns="jabber:client">
<query xmlns="jabber:iq:roster"></query>
</iq>
</body>

サーバーの応答

<body xmlns="http://jabber.org/protocol/httpbind" ack="404208005">
<iq id="1" type="result" to="sat@canopus30/5cou8tu8ka" xmlns="jabber:client">
<query xmlns="jabber:iq:roster">
<item jid="sat1@canopus30" subscription="to"></item>
</query>
</iq>
</body>

リクエストとレスポンスで、ユーザー情報ではないことがわかります。ユーザーの作成(登録)時に指定した少なくともフルネームのリクエストを受け取ったときに、ユーザー情報を見つけるのを手伝ってください。ありがとうございました。

4

0 に答える 0