Transcript
Page 1: Chat+twitter app with lift

Lift のチュートリアルを改造して

Twitter 連携チャットを作るScala 勉強会第 9 回 in 渋谷鹿島和郎(かしまかずお)

Page 2: Chat+twitter app with lift

自己紹介

• 鹿島和郎(かしまかずお)• 今日は時間があまりないので省略。

Page 3: Chat+twitter app with lift

Agenda

• Chat App demo

• Programs used– Lift– Dispatch

• Code reading

• Related Technologies– OAuth– Comet

Page 4: Chat+twitter app with lift

Chat App demo

• Authentication (OAuth)

• Callback

• Chat (Comet)

• Known issues

Page 5: Chat+twitter app with lift

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

Page 6: Chat+twitter app with lift

Code reading

• Basics– index.html & OAuthTest.scala– Boot.scala– TwitterCallback.scala

• Comet– index.html & Chat.scala

• Model– User.scala

Page 7: Chat+twitter app with lift

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

Page 8: Chat+twitter app with lift

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

Page 9: Chat+twitter app with lift

Comet (cont.)

• Implementation models– Streaming– Long polling (★ 今回はこっち、のはず )

• Server side– Different challenges, approaches→ Out of scope of this presentation

• 参考– Wikipediaのエントリ– Comet の正しい使い方:奥さん( Cyboze

Labs )


Top Related