XMPP仕様簡単解説

Keiichi Daiba
Keiichi DaibaNTT Resonant Inc.
 
規格 ,[object Object],[object Object],[object Object],[object Object],[object Object],沢山あるけど,基本はこんな感じ
JID 各パーツは 1023B 以下 “ @ “ とか “ / “ とかも含めて 3071B 以下 IPv4address / IPv6address = address-literal ( internationalized domain label ) = sub-domain ( sub-domain 1 * ( “ . “  sub-domain ) ) = fqdn fqdn / address-literal = domain [ node “ @ ” ] domain [ “ / ” resource ] = jid
メッセージ転送 ( client / server ) ,[object Object],[object Object],[object Object],[object Object],< user @ example . com > < user @ example . com / resouce > 一致するアカウントがなければ無視,もしくはエラー ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
メッセージ転送 ( server / server ) ,[object Object],[object Object],[object Object],[object Object]
セッション TCP TLS SASL Resource Binding ( user @ domain / resource ) クライアント サーバ < session / > < message / >, < presence / > option メッセージの やりとりをする までに必要な 設定
message syntax ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
IQ ( Info / Query ) syntax Requesting Entity Responding Entity < iq type = ‘ get ‘ id = ‘ 1 ‘ > < iq type = ‘ result ‘ id = ‘ 1 ‘ > < iq type = ‘ set ‘ id = ‘ 2 ‘ > < iq type = ‘ error ‘ id = ‘ 2 ‘ > type 属性は4 種類 理由がない限り必須 id 属性も理由がない限り必須
Psi2OpenFire  (設定) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Psi2OpenFire ( TLS 開設まで) -- C2S— <?xml version=&quot;1.0&quot;?> <stream:stream xmlns:stream=&quot;http://etherx.jabber.org/streams&quot; version=&quot;1.0&quot; xmlns=&quot;jabber:client&quot; to=&quot;foo.hoge.co.jp&quot; xml:lang=&quot;en&quot; xmlns:xml=&quot;http://www.w3.org/XML/1998/namespace&quot; > -- S2C -- <?xml version='1.0' encoding='UTF-8'?> <stream:stream xmlns:stream=&quot;http://etherx.jabber.org/streams&quot; xmlns=&quot;jabber:client&quot; from=&quot;foo.hoge.co.jp&quot; id=&quot;b9a694d9&quot; xml:lang=&quot;en&quot; version=&quot;1.0&quot;> -- S2C -- -- TLS による通信要求  -- <stream:features> <starttls xmlns=&quot;urn:ietf:params:xml:ns:xmpp-tls&quot;/> <mechanisms xmlns=&quot;urn:ietf:params:xml:ns:xmpp-sasl&quot;> <mechanism>PLAIN</mechanism> <mechanism>CRAM-MD5</mechanism> <mechanism>ANONYMOUS</mechanism> <mechanism>DIGEST-MD5</mechanism> </mechanisms> <compression xmlns=&quot;http://jabber.org/features/compress&quot;> <method>zlib</method> </compression> <auth xmlns=&quot;http://jabber.org/features/iq-auth&quot;/> <register xmlns=&quot;http://jabber.org/features/iq-register&quot;/> </stream:features> -- C2S -- -- TLS による通信開始  -- <starttls xmlns=&quot;urn:ietf:params:xml:ns:xmpp-tls&quot;/> -- S2C -- --  サーバが TLS 開始を確認  -- <proceed xmlns=&quot;urn:ietf:params:xml:ns:xmpp-tls&quot;/> よくみると,サーバは一度に要求 してるが,クライアントはひとつずつ 応えている
セッション TCP TLS SASL Resource Binding ( user @ domain / resource ) クライアント サーバ < session / > < message / >, < presence / > option メッセージの やりとりをする までに必要な 設定
Psi2OpenFire ( SASL 開設まで) -- C2S -- -- TLS による通信開始  -- <?xml version=&quot;1.0&quot;?> <stream:stream xmlns:stream=&quot;http://etherx.jabber.org/streams&quot; version=&quot;1.0&quot; xmlns=&quot;jabber:client&quot; to=&quot;foo.hoge.co.jp&quot; xml:lang=&quot;en&quot; xmlns:xml=&quot;http://www.w3.org/XML/1998/namespace&quot; > -- S2C -- --  サーバからの応答開始  -- <?xml version='1.0' encoding='UTF-8'?> <stream:stream xmlns:stream=&quot;http://etherx.jabber.org/streams&quot; xmlns=&quot;jabber:client&quot; from=&quot;foo.hoge.co.jp&quot; id=&quot;b9a694d9&quot; xml:lang=&quot;en&quot; version=&quot;1.0&quot;> -- S2C -- -- SASL 要求  -- <stream:features> <mechanisms xmlns=&quot;urn:ietf:params:xml:ns:xmpp-sasl&quot;> <mechanism>PLAIN</mechanism> <mechanism>CRAM-MD5</mechanism> <mechanism>ANONYMOUS</mechanism> <mechanism>DIGEST-MD5</mechanism> </mechanisms> <compression xmlns=&quot;http://jabber.org/features/compress&quot;> <method>zlib</method> </compression> <auth xmlns=&quot;http://jabber.org/features/iq-auth&quot;/> <register xmlns=&quot;http://jabber.org/features/iq-register&quot;/> </stream:features> -- C2S -- <auth xmlns=&quot;urn:ietf:params:xml:ns:xmpp-sasl“ mechanism=&quot;DIGEST-MD5&quot; /> -- S2C -- <challenge xmlns=&quot;urn:ietf:params:xml:ns:xmpp-sasl&quot;>...</challenge> -- C2S -- --  クライアントがレスポンスを送信  -- <response xmlns=&quot;urn:ietf:params:xml:ns:xmpp-sasl&quot;>...</response> -- S2C -- --  サーバが認証成功宣言  -- <success xmlns=&quot;urn:ietf:params:xml:ns:xmpp-sasl&quot;>...</success> GTalk は SSL を使ってるので TLS での通信要求はでない
セッション TCP TLS SASL Resource Binding ( user @ domain / resource ) クライアント サーバ < session / > < message / >, < presence / > option メッセージの やりとりをする までに必要な 設定
Psi2OpenFire (圧縮モード設定まで) -- C2S -- -- SASL ベースで再度アクセス  -- <?xml version=&quot;1.0&quot;?> <stream:stream xmlns:stream=&quot;http://etherx.jabber.org/streams&quot; version=&quot;1.0&quot; xmlns=&quot;jabber:client&quot; to=&quot;foo.hoge.co.jp&quot; xml:lang=&quot;en&quot; xmlns:xml=&quot;http://www.w3.org/XML/1998/namespace&quot; > -- S2C -- --  サーバ応答  -- <?xml version='1.0' encoding='UTF-8'?> <stream:stream xmlns:stream=&quot;http://etherx.jabber.org/streams&quot; xmlns=&quot;jabber:client&quot; from=&quot;foo.hoge.co.jp&quot; id=&quot;b9a694d9&quot; xml:lang=&quot;en&quot; version=&quot;1.0&quot;> -- S2C -- -- traffic を圧縮するかどうかを確認してる  -- -- Psi で &quot;Compress traffic&quot; にチェックしてないので無反応  -- <stream:features> <compression xmlns=&quot;http://jabber.org/features/compress&quot;> <method>zlib</method> </compression> <bind xmlns=&quot;urn:ietf:params:xml:ns:xmpp-bind&quot;/> <session xmlns=&quot;urn:ietf:params:xml:ns:xmpp-session&quot;/> </stream:features>
Psi2OpenFire ( Roster 取得まで) -- C2S -- -- Client asks server to bind a resource: -- -- RFC3920 7. Resource Binding -- <iq type=&quot;set&quot; id=&quot;bind_1&quot; > <bind xmlns=&quot;urn:ietf:params:xml:ns:xmpp-bind&quot;> <resource>Psi</resource> </bind> </iq> -- S2C -- -- Server informs client of successful resource binding: -- -- RFC3920 7. Resource Binding -- <iq xmlns=&quot;jabber:client&quot; type=&quot;result&quot; id=&quot;bind_1&quot; to=&quot;foo.hoge.co.jp/b9a694d9&quot; > <bind xmlns=&quot;urn:ietf:params:xml:ns:xmpp-bind&quot;> <jid> daiba@foo.hoge.co.jp/Psi </jid> </bind> </iq> -- C2S -- -- Client requests session with server: -- -- RFC3921 3. Session Establishment -- <iq type=&quot;set&quot; id=&quot;aab5a&quot; > <session xmlns=&quot;urn:ietf:params:xml:ns:xmpp-session&quot;/> </iq> -- S2C -- --Server informs client that session has been created -- --  この段階で &quot;active resource&quot; としてサーバに登録された  -- <iq type=&quot;result&quot; id=&quot;aab5a&quot; to=&quot;daiba@foo.hoge.co.jp/Psi&quot; > <session xmlns=&quot;urn:ietf:params:xml:ns:xmpp-session&quot;/> </iq> -- C2S -- -- Client requests current roster from server: -- -- 7.3. Retrieving One's Roster on Login -- <iq type=&quot;get&quot; id=&quot;aab6a&quot; > <query xmlns=&quot;jabber:iq:roster&quot;/> </iq> -- S2C -- -- Client receives roster from server: -- <iq type=&quot;result&quot; id=&quot;aab6a&quot; to=&quot;daiba@foo.hoge.co.jp/Psi&quot; > <query xmlns=&quot;jabber:iq:roster&quot;/> </iq> resource  ってのは, [email_address]  / Psi  の “  Psi “  の部分
Psi2OpenFire ( Priority 設定まで) -- C2S -- -- Presence priority: -- -- RFC3921 5.4. Specifying Presence Priority -- <presence> <priority>5</priority> <c xmlns=&quot;http://jabber.org/protocol/caps&quot; node=&quot;http://psi-im.org/caps&quot; ver=&quot;0.11-dev-rev8&quot; ext=&quot;cs ep-notify html&quot; /> </presence>
Psi2GoogleTalk ( Roster 取得) -- C2S -- -- Client requests current roster from server: -- -- 7.3. Retrieving One's Roster on Login -- <iq type=&quot;get&quot; id=&quot;aab6a&quot; > <query xmlns=&quot;jabber:iq:roster&quot;/> </iq> -- S2C -- -- Client receives roster from server: -- <iq type=&quot;result&quot; to=&quot;daibak@gmail.com/griffin9EB3DE9D&quot; id=&quot;aab6a&quot; > <query xmlns=&quot;jabber:iq:roster&quot;> <item subscription=“both” name=“ 誰か &quot; jid=“noname@gmail.com&quot; /> <item subscription=&quot;both&quot; jid=&quot;twitter@twitter.com&quot; /> <item subscription=&quot;both&quot; jid=&quot;jaiku@jaiku.com&quot; > <group>Buddies</group> </item> </query> </iq>
Psi2GoogleTalk ( vCard 取得) -- C2S -- -- vCard Action: Resulting Stanza -- -- XEP-0054 6.2 URI Query Types -- <iq type=&quot;get&quot; to=&quot;daibak@gmail.com&quot; id=&quot;aab9a&quot; > <vCard xmlns=&quot;vcard-temp“ version=&quot;2.0“ prodid=&quot;-//HandGen//NONSGML vGen v1.0//EN&quot; /> </iq> <iq from= [email_address] type=&quot;result“ to=daibak@gmail.com/griffin9EB3DE9D id=&quot;aab9a&quot; > <vCard xmlns=&quot;vcard-temp&quot;> <FN>Keiichi daiba</FN> <PHOTO> <TYPE>image/jpeg</TYPE> <BINVAL>...</BINVAL> </PHOTO> </vCard> </iq> バイナリデータをBasa64? 変換して埋め込んである
Psi2GoogleTalk (メッセージ送受信) -- BOT  にメッセージを送る  -- <message type=&quot;chat&quot; to=&quot;en2ja@bot.talk.google.com&quot; id=&quot;aabea&quot; > <body>general</body> <active xmlns=&quot;http://jabber.org/protocol/chatstates&quot;/> </message> <message from=&quot;en2ja@bot.talk.google.com&quot; type=&quot;chat&quot; to=&quot;daibak@gmail.com/griffinEB79CC3A&quot; > <body> 全般 </body> </message>
Psi2OpenFire (ルーム作成) -- C2S -- --  チャットルーム作成  -- <presence to=&quot;test@ conference .foo.hoge.co.jp/test&quot; > <priority>0</priority> <x xmlns=&quot;http://jabber.org/protocol/muc&quot;> <history maxchars=&quot;0&quot; /> </x> </presence> -- S2C – --  成功  -- <presence from=test@conference.foo.hoge.co.jp/test to=“daiba@foo.hoge.co.jp/Psi&quot; > <priority>0</priority> <x xmlns=&quot;http://jabber.org/protocol/muc#user&quot;> <item affiliation=&quot;owner“ role=&quot;moderator“ jid=“daiba@foo.hoge.co.jp/Psi&quot; /> <status code=&quot;201&quot; /> </x> </presence> “  conference “  は  OpenFire  のデフォルト設定 ルーム名 “  test “ ,ニックネームも “  test “ -- C2S -- <iq type=&quot;set&quot; to=&quot;test@conference.foo.hoge.co.jp&quot; id=&quot;aac1a&quot; > <query xmlns=&quot;http://jabber.org/protocol/muc#owner&quot;> <x xmlns=&quot;jabber:x:data&quot; type=&quot;submit&quot; /> </query> </iq> -- S2C – <message from=test@conference.foo.hoge.co.jp type=&quot;groupchat“ to=“daiba@foo.hoge.co.jp/Psi&quot; > <body> This room is locked from entry until configuration is confirmed. </body> </message> <message from=test@conference.foo.hoge.co.jp type=&quot;groupchat“ to=“daiba@foo.hoge.co.jp/Psi&quot; > <body>This room is now unlocked.</body> </message> 作成した状態ではLOCKされてるので submit してUNLOCK
Psi2OpenFire (設定確認) -- C2S -- --  設定確認 – <iq from=‘daiba@foo.hoge.co.jp/Psi' id='config1' to='test@conference.foo.hoge.co.jp' type='get'> <query  xmlns='http://jabber.org/protocol/muc#owner'/> </iq> -- S2C -- --  確認したデータ  -- <iq from=test@conference.foo.hoge.co.jp type=&quot;result“ id=&quot;config1“ to=“daiba@foo.hoge.co.jp/Psi&quot; > <query xmlns=&quot;http://jabber.org/protocol/muc#owner&quot;> <x xmlns=&quot;jabber:x:data&quot; type=&quot;form&quot; > <title>Room configuration</title> <instructions>...</instructions> <field type=&quot;hidden&quot; var=&quot;FORM_TYPE&quot; > <value>http://jabber.org/protocol/muc#roomconfig</value> </field> <field type=&quot;text-single“ label=&quot;Room Name“ var=&quot;muc#roomconfig_roomname&quot; > <value>test</value> </field> ... <field type=&quot;list-single“ label=&quot;Maximum Room Occupants“ var=&quot;muc#roomconfig_maxusers&quot; > <value>30</value> <option label=&quot;10&quot; > <value>10</value> </option> <option label=&quot;20&quot; > <value>20</value> </option> <option label=&quot;30&quot; > <value>30</value> </option> <option label=&quot;40&quot; > <value>40</value> </option> <option label=&quot;50&quot; > <value>50</value> </option> <option label=&quot;None&quot; > <value>0</value> </option> </field> ... </x> </query> </iq> 初期設定で, 参加可能な人数は30 パラメータを何も 指定しないとすべての 設定を返す
Psi2OpenFire (設定変更) --  設定変更  -- -- C2S -- <iq from=‘daiba@foo.hoge.co.jp/Psi' id='create2' to='test@conference.foo.hoge.co.jp' type='set'> <query xmlns='http://jabber.org/protocol/muc#owner'> <x xmlns='jabber:x:data' type='submit'> <field var='muc#roomconfig_maxusers'> <value>0</value> </field> </x> </query> </iq> -- S2C -- <iq from=test@conference.turk.nttr.co.jp type=&quot;result“ id=&quot;create2“ to=“daiba@foo.hoge.co.jp/Psi&quot; /> Psi  の XML コンソールを使って手動で XML 送信 < value > 0 < / value >  が最大入室無制限
1 of 22

Recommended

20171005 告白に学ぶ http status code by
20171005 告白に学ぶ http status code20171005 告白に学ぶ http status code
20171005 告白に学ぶ http status codeShinichi Takahashi
11.1K views76 slides
XMPPの紹介 by
XMPPの紹介XMPPの紹介
XMPPの紹介隆行 神戸
5.6K views20 slides
XMPPクライアント・プログラミング by
XMPPクライアント・プログラミングXMPPクライアント・プログラミング
XMPPクライアント・プログラミング隆行 神戸
1.7K views36 slides
Javaパフォーマンスチューニング基礎 by
Javaパフォーマンスチューニング基礎Javaパフォーマンスチューニング基礎
Javaパフォーマンスチューニング基礎Hiroyuki Ohnaka
7K views24 slides
Message delivery over XMPP network by
Message delivery over XMPP networkMessage delivery over XMPP network
Message delivery over XMPP networkHideki Saito
587 views25 slides
Transports on XMPP network by
Transports on XMPP networkTransports on XMPP network
Transports on XMPP networkHideki Saito
649 views11 slides

More Related Content

Viewers also liked

Evolution of Public Relations Through Content Marketing - Congreso PRORP by
Evolution of Public Relations Through Content Marketing - Congreso PRORP  Evolution of Public Relations Through Content Marketing - Congreso PRORP
Evolution of Public Relations Through Content Marketing - Congreso PRORP TopRank Marketing Agency
924 views64 slides
Convergence: Social Media SEO Content Marketing SES Chicago 2011 by
Convergence: Social Media SEO Content Marketing SES Chicago 2011Convergence: Social Media SEO Content Marketing SES Chicago 2011
Convergence: Social Media SEO Content Marketing SES Chicago 2011TopRank Marketing Agency
2.3K views28 slides
Content Marketing Strategy - The Future is Bright for Web Content by
Content Marketing Strategy - The Future is Bright for Web Content Content Marketing Strategy - The Future is Bright for Web Content
Content Marketing Strategy - The Future is Bright for Web Content TopRank Marketing Agency
4.1K views35 slides
Classics by
ClassicsClassics
ClassicsNinu
712 views23 slides
The butterfly_The flower by
The butterfly_The flowerThe butterfly_The flower
The butterfly_The flowerNinu
486 views10 slides
Create Demand and Influence with Co-Created Content for B2B Marketing by
Create Demand and Influence with Co-Created Content for B2B MarketingCreate Demand and Influence with Co-Created Content for B2B Marketing
Create Demand and Influence with Co-Created Content for B2B MarketingTopRank Marketing Agency
9.5K views43 slides

Viewers also liked(20)

Evolution of Public Relations Through Content Marketing - Congreso PRORP by TopRank Marketing Agency
Evolution of Public Relations Through Content Marketing - Congreso PRORP  Evolution of Public Relations Through Content Marketing - Congreso PRORP
Evolution of Public Relations Through Content Marketing - Congreso PRORP
Content Marketing Strategy - The Future is Bright for Web Content by TopRank Marketing Agency
Content Marketing Strategy - The Future is Bright for Web Content Content Marketing Strategy - The Future is Bright for Web Content
Content Marketing Strategy - The Future is Bright for Web Content
Classics by Ninu
ClassicsClassics
Classics
Ninu712 views
The butterfly_The flower by Ninu
The butterfly_The flowerThe butterfly_The flower
The butterfly_The flower
Ninu486 views
Create Demand and Influence with Co-Created Content for B2B Marketing by TopRank Marketing Agency
Create Demand and Influence with Co-Created Content for B2B MarketingCreate Demand and Influence with Co-Created Content for B2B Marketing
Create Demand and Influence with Co-Created Content for B2B Marketing
Erlang with Regexp Perl And Port by Keiichi Daiba
Erlang with Regexp Perl And PortErlang with Regexp Perl And Port
Erlang with Regexp Perl And Port
Keiichi Daiba1.2K views
Content Marketing - How to Optimize & Socialize for Better Performance by TopRank Marketing Agency
Content Marketing  - How to Optimize & Socialize for Better PerformanceContent Marketing  - How to Optimize & Socialize for Better Performance
Content Marketing - How to Optimize & Socialize for Better Performance
[Erlang LT] Regexp Perl And Port by Keiichi Daiba
[Erlang LT] Regexp Perl And Port[Erlang LT] Regexp Perl And Port
[Erlang LT] Regexp Perl And Port
Keiichi Daiba971 views
Web-Scale Discovery: Post Implementation by Rachel Vacek
Web-Scale Discovery: Post ImplementationWeb-Scale Discovery: Post Implementation
Web-Scale Discovery: Post Implementation
Rachel Vacek2.1K views

Similar to XMPP仕様簡単解説

HTML5でセマンティックなマークアップ by
HTML5でセマンティックなマークアップHTML5でセマンティックなマークアップ
HTML5でセマンティックなマークアップShumpei Shiraishi
7.2K views39 slides
Keynote In Japanese by
Keynote In JapaneseKeynote In Japanese
Keynote In JapaneseKuniyoshi Murata
463 views16 slides
Struts2を始めよう! by
Struts2を始めよう!Struts2を始めよう!
Struts2を始めよう!Shinpei Ohtani
7.2K views41 slides
実社会で進められているサービスとLOD by
実社会で進められているサービスとLOD実社会で進められているサービスとLOD
実社会で進められているサービスとLODHiroyuki Sato
928 views26 slides
webを飾る技術 by
webを飾る技術webを飾る技術
webを飾る技術ina job
1.1K views39 slides
MT meets PHP by
MT meets PHPMT meets PHP
MT meets PHP純生 野田
10K views56 slides

Similar to XMPP仕様簡単解説(20)

HTML5でセマンティックなマークアップ by Shumpei Shiraishi
HTML5でセマンティックなマークアップHTML5でセマンティックなマークアップ
HTML5でセマンティックなマークアップ
Shumpei Shiraishi7.2K views
実社会で進められているサービスとLOD by Hiroyuki Sato
実社会で進められているサービスとLOD実社会で進められているサービスとLOD
実社会で進められているサービスとLOD
Hiroyuki Sato928 views
webを飾る技術 by ina job
webを飾る技術webを飾る技術
webを飾る技術
ina job1.1K views
MT meets PHP - PHP conference Kansai 2013 by 純生 野田
MT meets PHP - PHP conference Kansai 2013MT meets PHP - PHP conference Kansai 2013
MT meets PHP - PHP conference Kansai 2013
純生 野田18.3K views
日常業務にperlを使おう by turugina
 日常業務にperlを使おう 日常業務にperlを使おう
日常業務にperlを使おう
turugina2K views
HTML仕様書を読んでみよう by Saeki Tominaga
HTML仕様書を読んでみようHTML仕様書を読んでみよう
HTML仕様書を読んでみよう
Saeki Tominaga6.4K views
2008.10.18 L4u Tech Talk by mitamex4u
2008.10.18 L4u Tech Talk2008.10.18 L4u Tech Talk
2008.10.18 L4u Tech Talk
mitamex4u2.4K views
Ruby on Rails Tutorial Chapter8-10 by Sea Mountain
Ruby on Rails Tutorial Chapter8-10Ruby on Rails Tutorial Chapter8-10
Ruby on Rails Tutorial Chapter8-10
Sea Mountain1.3K views
PHP, Now and Then 2011 by Rui Hirokawa
PHP, Now and Then 2011PHP, Now and Then 2011
PHP, Now and Then 2011
Rui Hirokawa1.3K views
JavaScript&Firebug入門 by 柴田 篤志
JavaScript&Firebug入門JavaScript&Firebug入門
JavaScript&Firebug入門
柴田 篤志666 views
Code Igniterについて by Keita Ojima
Code IgniterについてCode Igniterについて
Code Igniterについて
Keita Ojima876 views
エンジニア知識共有会発表資料 20090910 by ngi group.
エンジニア知識共有会発表資料 20090910エンジニア知識共有会発表資料 20090910
エンジニア知識共有会発表資料 20090910
ngi group.456 views
Perl logging by keroyonn
Perl loggingPerl logging
Perl logging
keroyonn3.3K views

XMPP仕様簡単解説

  • 1.  
  • 2.
  • 3. JID 各パーツは 1023B 以下 “ @ “ とか “ / “ とかも含めて 3071B 以下 IPv4address / IPv6address = address-literal ( internationalized domain label ) = sub-domain ( sub-domain 1 * ( “ . “ sub-domain ) ) = fqdn fqdn / address-literal = domain [ node “ @ ” ] domain [ “ / ” resource ] = jid
  • 4.
  • 5.
  • 6. セッション TCP TLS SASL Resource Binding ( user @ domain / resource ) クライアント サーバ < session / > < message / >, < presence / > option メッセージの やりとりをする までに必要な 設定
  • 7.
  • 8. IQ ( Info / Query ) syntax Requesting Entity Responding Entity < iq type = ‘ get ‘ id = ‘ 1 ‘ > < iq type = ‘ result ‘ id = ‘ 1 ‘ > < iq type = ‘ set ‘ id = ‘ 2 ‘ > < iq type = ‘ error ‘ id = ‘ 2 ‘ > type 属性は4 種類 理由がない限り必須 id 属性も理由がない限り必須
  • 9.
  • 10. Psi2OpenFire ( TLS 開設まで) -- C2S— <?xml version=&quot;1.0&quot;?> <stream:stream xmlns:stream=&quot;http://etherx.jabber.org/streams&quot; version=&quot;1.0&quot; xmlns=&quot;jabber:client&quot; to=&quot;foo.hoge.co.jp&quot; xml:lang=&quot;en&quot; xmlns:xml=&quot;http://www.w3.org/XML/1998/namespace&quot; > -- S2C -- <?xml version='1.0' encoding='UTF-8'?> <stream:stream xmlns:stream=&quot;http://etherx.jabber.org/streams&quot; xmlns=&quot;jabber:client&quot; from=&quot;foo.hoge.co.jp&quot; id=&quot;b9a694d9&quot; xml:lang=&quot;en&quot; version=&quot;1.0&quot;> -- S2C -- -- TLS による通信要求 -- <stream:features> <starttls xmlns=&quot;urn:ietf:params:xml:ns:xmpp-tls&quot;/> <mechanisms xmlns=&quot;urn:ietf:params:xml:ns:xmpp-sasl&quot;> <mechanism>PLAIN</mechanism> <mechanism>CRAM-MD5</mechanism> <mechanism>ANONYMOUS</mechanism> <mechanism>DIGEST-MD5</mechanism> </mechanisms> <compression xmlns=&quot;http://jabber.org/features/compress&quot;> <method>zlib</method> </compression> <auth xmlns=&quot;http://jabber.org/features/iq-auth&quot;/> <register xmlns=&quot;http://jabber.org/features/iq-register&quot;/> </stream:features> -- C2S -- -- TLS による通信開始 -- <starttls xmlns=&quot;urn:ietf:params:xml:ns:xmpp-tls&quot;/> -- S2C -- -- サーバが TLS 開始を確認 -- <proceed xmlns=&quot;urn:ietf:params:xml:ns:xmpp-tls&quot;/> よくみると,サーバは一度に要求 してるが,クライアントはひとつずつ 応えている
  • 11. セッション TCP TLS SASL Resource Binding ( user @ domain / resource ) クライアント サーバ < session / > < message / >, < presence / > option メッセージの やりとりをする までに必要な 設定
  • 12. Psi2OpenFire ( SASL 開設まで) -- C2S -- -- TLS による通信開始 -- <?xml version=&quot;1.0&quot;?> <stream:stream xmlns:stream=&quot;http://etherx.jabber.org/streams&quot; version=&quot;1.0&quot; xmlns=&quot;jabber:client&quot; to=&quot;foo.hoge.co.jp&quot; xml:lang=&quot;en&quot; xmlns:xml=&quot;http://www.w3.org/XML/1998/namespace&quot; > -- S2C -- -- サーバからの応答開始 -- <?xml version='1.0' encoding='UTF-8'?> <stream:stream xmlns:stream=&quot;http://etherx.jabber.org/streams&quot; xmlns=&quot;jabber:client&quot; from=&quot;foo.hoge.co.jp&quot; id=&quot;b9a694d9&quot; xml:lang=&quot;en&quot; version=&quot;1.0&quot;> -- S2C -- -- SASL 要求 -- <stream:features> <mechanisms xmlns=&quot;urn:ietf:params:xml:ns:xmpp-sasl&quot;> <mechanism>PLAIN</mechanism> <mechanism>CRAM-MD5</mechanism> <mechanism>ANONYMOUS</mechanism> <mechanism>DIGEST-MD5</mechanism> </mechanisms> <compression xmlns=&quot;http://jabber.org/features/compress&quot;> <method>zlib</method> </compression> <auth xmlns=&quot;http://jabber.org/features/iq-auth&quot;/> <register xmlns=&quot;http://jabber.org/features/iq-register&quot;/> </stream:features> -- C2S -- <auth xmlns=&quot;urn:ietf:params:xml:ns:xmpp-sasl“ mechanism=&quot;DIGEST-MD5&quot; /> -- S2C -- <challenge xmlns=&quot;urn:ietf:params:xml:ns:xmpp-sasl&quot;>...</challenge> -- C2S -- -- クライアントがレスポンスを送信 -- <response xmlns=&quot;urn:ietf:params:xml:ns:xmpp-sasl&quot;>...</response> -- S2C -- -- サーバが認証成功宣言 -- <success xmlns=&quot;urn:ietf:params:xml:ns:xmpp-sasl&quot;>...</success> GTalk は SSL を使ってるので TLS での通信要求はでない
  • 13. セッション TCP TLS SASL Resource Binding ( user @ domain / resource ) クライアント サーバ < session / > < message / >, < presence / > option メッセージの やりとりをする までに必要な 設定
  • 14. Psi2OpenFire (圧縮モード設定まで) -- C2S -- -- SASL ベースで再度アクセス -- <?xml version=&quot;1.0&quot;?> <stream:stream xmlns:stream=&quot;http://etherx.jabber.org/streams&quot; version=&quot;1.0&quot; xmlns=&quot;jabber:client&quot; to=&quot;foo.hoge.co.jp&quot; xml:lang=&quot;en&quot; xmlns:xml=&quot;http://www.w3.org/XML/1998/namespace&quot; > -- S2C -- -- サーバ応答 -- <?xml version='1.0' encoding='UTF-8'?> <stream:stream xmlns:stream=&quot;http://etherx.jabber.org/streams&quot; xmlns=&quot;jabber:client&quot; from=&quot;foo.hoge.co.jp&quot; id=&quot;b9a694d9&quot; xml:lang=&quot;en&quot; version=&quot;1.0&quot;> -- S2C -- -- traffic を圧縮するかどうかを確認してる -- -- Psi で &quot;Compress traffic&quot; にチェックしてないので無反応 -- <stream:features> <compression xmlns=&quot;http://jabber.org/features/compress&quot;> <method>zlib</method> </compression> <bind xmlns=&quot;urn:ietf:params:xml:ns:xmpp-bind&quot;/> <session xmlns=&quot;urn:ietf:params:xml:ns:xmpp-session&quot;/> </stream:features>
  • 15. Psi2OpenFire ( Roster 取得まで) -- C2S -- -- Client asks server to bind a resource: -- -- RFC3920 7. Resource Binding -- <iq type=&quot;set&quot; id=&quot;bind_1&quot; > <bind xmlns=&quot;urn:ietf:params:xml:ns:xmpp-bind&quot;> <resource>Psi</resource> </bind> </iq> -- S2C -- -- Server informs client of successful resource binding: -- -- RFC3920 7. Resource Binding -- <iq xmlns=&quot;jabber:client&quot; type=&quot;result&quot; id=&quot;bind_1&quot; to=&quot;foo.hoge.co.jp/b9a694d9&quot; > <bind xmlns=&quot;urn:ietf:params:xml:ns:xmpp-bind&quot;> <jid> daiba@foo.hoge.co.jp/Psi </jid> </bind> </iq> -- C2S -- -- Client requests session with server: -- -- RFC3921 3. Session Establishment -- <iq type=&quot;set&quot; id=&quot;aab5a&quot; > <session xmlns=&quot;urn:ietf:params:xml:ns:xmpp-session&quot;/> </iq> -- S2C -- --Server informs client that session has been created -- -- この段階で &quot;active resource&quot; としてサーバに登録された -- <iq type=&quot;result&quot; id=&quot;aab5a&quot; to=&quot;daiba@foo.hoge.co.jp/Psi&quot; > <session xmlns=&quot;urn:ietf:params:xml:ns:xmpp-session&quot;/> </iq> -- C2S -- -- Client requests current roster from server: -- -- 7.3. Retrieving One's Roster on Login -- <iq type=&quot;get&quot; id=&quot;aab6a&quot; > <query xmlns=&quot;jabber:iq:roster&quot;/> </iq> -- S2C -- -- Client receives roster from server: -- <iq type=&quot;result&quot; id=&quot;aab6a&quot; to=&quot;daiba@foo.hoge.co.jp/Psi&quot; > <query xmlns=&quot;jabber:iq:roster&quot;/> </iq> resource ってのは, [email_address] / Psi の “ Psi “ の部分
  • 16. Psi2OpenFire ( Priority 設定まで) -- C2S -- -- Presence priority: -- -- RFC3921 5.4. Specifying Presence Priority -- <presence> <priority>5</priority> <c xmlns=&quot;http://jabber.org/protocol/caps&quot; node=&quot;http://psi-im.org/caps&quot; ver=&quot;0.11-dev-rev8&quot; ext=&quot;cs ep-notify html&quot; /> </presence>
  • 17. Psi2GoogleTalk ( Roster 取得) -- C2S -- -- Client requests current roster from server: -- -- 7.3. Retrieving One's Roster on Login -- <iq type=&quot;get&quot; id=&quot;aab6a&quot; > <query xmlns=&quot;jabber:iq:roster&quot;/> </iq> -- S2C -- -- Client receives roster from server: -- <iq type=&quot;result&quot; to=&quot;daibak@gmail.com/griffin9EB3DE9D&quot; id=&quot;aab6a&quot; > <query xmlns=&quot;jabber:iq:roster&quot;> <item subscription=“both” name=“ 誰か &quot; jid=“noname@gmail.com&quot; /> <item subscription=&quot;both&quot; jid=&quot;twitter@twitter.com&quot; /> <item subscription=&quot;both&quot; jid=&quot;jaiku@jaiku.com&quot; > <group>Buddies</group> </item> </query> </iq>
  • 18. Psi2GoogleTalk ( vCard 取得) -- C2S -- -- vCard Action: Resulting Stanza -- -- XEP-0054 6.2 URI Query Types -- <iq type=&quot;get&quot; to=&quot;daibak@gmail.com&quot; id=&quot;aab9a&quot; > <vCard xmlns=&quot;vcard-temp“ version=&quot;2.0“ prodid=&quot;-//HandGen//NONSGML vGen v1.0//EN&quot; /> </iq> <iq from= [email_address] type=&quot;result“ to=daibak@gmail.com/griffin9EB3DE9D id=&quot;aab9a&quot; > <vCard xmlns=&quot;vcard-temp&quot;> <FN>Keiichi daiba</FN> <PHOTO> <TYPE>image/jpeg</TYPE> <BINVAL>...</BINVAL> </PHOTO> </vCard> </iq> バイナリデータをBasa64? 変換して埋め込んである
  • 19. Psi2GoogleTalk (メッセージ送受信) -- BOT にメッセージを送る -- <message type=&quot;chat&quot; to=&quot;en2ja@bot.talk.google.com&quot; id=&quot;aabea&quot; > <body>general</body> <active xmlns=&quot;http://jabber.org/protocol/chatstates&quot;/> </message> <message from=&quot;en2ja@bot.talk.google.com&quot; type=&quot;chat&quot; to=&quot;daibak@gmail.com/griffinEB79CC3A&quot; > <body> 全般 </body> </message>
  • 20. Psi2OpenFire (ルーム作成) -- C2S -- -- チャットルーム作成 -- <presence to=&quot;test@ conference .foo.hoge.co.jp/test&quot; > <priority>0</priority> <x xmlns=&quot;http://jabber.org/protocol/muc&quot;> <history maxchars=&quot;0&quot; /> </x> </presence> -- S2C – -- 成功 -- <presence from=test@conference.foo.hoge.co.jp/test to=“daiba@foo.hoge.co.jp/Psi&quot; > <priority>0</priority> <x xmlns=&quot;http://jabber.org/protocol/muc#user&quot;> <item affiliation=&quot;owner“ role=&quot;moderator“ jid=“daiba@foo.hoge.co.jp/Psi&quot; /> <status code=&quot;201&quot; /> </x> </presence> “ conference “ は OpenFire のデフォルト設定 ルーム名 “ test “ ,ニックネームも “ test “ -- C2S -- <iq type=&quot;set&quot; to=&quot;test@conference.foo.hoge.co.jp&quot; id=&quot;aac1a&quot; > <query xmlns=&quot;http://jabber.org/protocol/muc#owner&quot;> <x xmlns=&quot;jabber:x:data&quot; type=&quot;submit&quot; /> </query> </iq> -- S2C – <message from=test@conference.foo.hoge.co.jp type=&quot;groupchat“ to=“daiba@foo.hoge.co.jp/Psi&quot; > <body> This room is locked from entry until configuration is confirmed. </body> </message> <message from=test@conference.foo.hoge.co.jp type=&quot;groupchat“ to=“daiba@foo.hoge.co.jp/Psi&quot; > <body>This room is now unlocked.</body> </message> 作成した状態ではLOCKされてるので submit してUNLOCK
  • 21. Psi2OpenFire (設定確認) -- C2S -- -- 設定確認 – <iq from=‘daiba@foo.hoge.co.jp/Psi' id='config1' to='test@conference.foo.hoge.co.jp' type='get'> <query xmlns='http://jabber.org/protocol/muc#owner'/> </iq> -- S2C -- -- 確認したデータ -- <iq from=test@conference.foo.hoge.co.jp type=&quot;result“ id=&quot;config1“ to=“daiba@foo.hoge.co.jp/Psi&quot; > <query xmlns=&quot;http://jabber.org/protocol/muc#owner&quot;> <x xmlns=&quot;jabber:x:data&quot; type=&quot;form&quot; > <title>Room configuration</title> <instructions>...</instructions> <field type=&quot;hidden&quot; var=&quot;FORM_TYPE&quot; > <value>http://jabber.org/protocol/muc#roomconfig</value> </field> <field type=&quot;text-single“ label=&quot;Room Name“ var=&quot;muc#roomconfig_roomname&quot; > <value>test</value> </field> ... <field type=&quot;list-single“ label=&quot;Maximum Room Occupants“ var=&quot;muc#roomconfig_maxusers&quot; > <value>30</value> <option label=&quot;10&quot; > <value>10</value> </option> <option label=&quot;20&quot; > <value>20</value> </option> <option label=&quot;30&quot; > <value>30</value> </option> <option label=&quot;40&quot; > <value>40</value> </option> <option label=&quot;50&quot; > <value>50</value> </option> <option label=&quot;None&quot; > <value>0</value> </option> </field> ... </x> </query> </iq> 初期設定で, 参加可能な人数は30 パラメータを何も 指定しないとすべての 設定を返す
  • 22. Psi2OpenFire (設定変更) -- 設定変更 -- -- C2S -- <iq from=‘daiba@foo.hoge.co.jp/Psi' id='create2' to='test@conference.foo.hoge.co.jp' type='set'> <query xmlns='http://jabber.org/protocol/muc#owner'> <x xmlns='jabber:x:data' type='submit'> <field var='muc#roomconfig_maxusers'> <value>0</value> </field> </x> </query> </iq> -- S2C -- <iq from=test@conference.turk.nttr.co.jp type=&quot;result“ id=&quot;create2“ to=“daiba@foo.hoge.co.jp/Psi&quot; /> Psi の XML コンソールを使って手動で XML 送信 < value > 0 < / value > が最大入室無制限