Download - Chat+twitter app with lift
Lift のチュートリアルを改造して
Twitter 連携チャットを作るScala 勉強会第 9 回 in 渋谷鹿島和郎(かしまかずお)
自己紹介
• 鹿島和郎(かしまかずお)• 今日は時間があまりないので省略。
Agenda
• Chat App demo
• Programs used– Lift– Dispatch
• Code reading
• Related Technologies– OAuth– Comet
Chat App demo
• Authentication (OAuth)
• Callback
• Chat (Comet)
• Known issues
This app uses…
• Lift– Web framework– View first– http://liftweb.net/
• Databinder Dispatch– Library for http and http services– Written in Scala– http://dispatch.databinder.net/About
Code reading
• Basics– index.html & OAuthTest.scala– Boot.scala– TwitterCallback.scala
• Comet– index.html & Chat.scala
• Model– User.scala
OAuth
• Players– Provider (Twitter)– Consumer (app)– User (human)
• Steps– The owner of the app registers it on dev.twitter.com.– The user approves the app to use his resource via
API.– The app gets an access token.– The app uses the access token to use the API.
• http://www.atmarkit.co.jp/fsecurity/special/106oauth/oauth02.html
Comet
• Traditional web apps (pull)– Request & response– Need real time?
→ A typical approach is Ajax polling.
• Comet (push)– Server sends data when it’s ready.– How? → Several approaches
Comet (cont.)
• Implementation models– Streaming– Long polling (★ 今回はこっち、のはず )
• Server side– Different challenges, approaches→ Out of scope of this presentation
• 参考– Wikipediaのエントリ– Comet の正しい使い方:奥さん( Cyboze
Labs )