Your SlideShare is downloading. ×
KSDG LT: 6分鐘node.JS就上手
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

KSDG LT: 6分鐘node.JS就上手

633

Published on

Source code …

Source code
https://github.com/ericpi/ksdg-chat

快快樂樂用~100行code寫出小型聊天室

Published in: Technology, Design
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
633
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
5
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. 6分鐘node.JS就上手 • Source code – https://github.com/ericpi/ksdg-chat • DEMO url – http://www.toofatcake.com:8080/ • ericpi • KKBOX S.RDC
  • 2. Node.JS 最有名的範例
  • 3. 只能回 hello world 的 httpd 能幹 嘛..
  • 4. 100行的 chatroom server • Source code – https://github.com/ericpi/ksdg-chat • DEMO url – http://www.toofatcake.com:8080/
  • 5. APIs • /join – 註冊加入chatroom, JSON response & set-cookie • /stream – Long polling 接口, HTML p tag response • /send – 送出訊息, JSON response • / – 客戶端介面, html & javascript code for Browser (client.html)
  • 6. server browser GET / client.html POST /join /join response GET /stream user interaction client js process POST /send wait for event /send response /stream response GET /stream ………... client js process
  • 7. Client code (105 lines) Server code (101 lines)
  • 8. 未完成 • API error handling • Exclusive Problem • Message Queue & Log • Javascript style & flow control • Node.JS modulize • More…
  • 9. Thanks

×