• Like

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Nodejs Introduction

  • 3,703 views
Uploaded on

2010/11/20 …

2010/11/20
JStudy#2
(一部誤植訂正済)

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
3,703
On Slideshare
0
From Embeds
0
Number of Embeds
3

Actions

Shares
Downloads
55
Comments
0
Likes
9

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. 2010 11 21
  • 2. Jack 2010 11 21
  • 3. 2010 11 21
  • 4. 2010 11 21
  • 5. 2010 11 21
  • 6. 2010 11 21
  • 7. 2010 11 21
  • 8. 2010 11 21
  • 9. 2010 11 21
  • 10. 2010 11 21
  • 11. 2010 11 21
  • 12. 2010 11 21
  • 13. 2010 11 21
  • 14. 2010 11 21
  • 15. 2010 11 21
  • 16. 2010 11 21
  • 17. 2010 11 21
  • 18. 2010 11 21
  • 19. Ryan Dahl 2010 11 21
  • 20. 2010 11 21
  • 21. 2010 11 21
  • 22. 2010 11 21
  • 23. 2010 11 21
  • 24. 2010 11 21
  • 25. 2010 11 21
  • 26. 2010 11 21
  • 27. 2010 11 21
  • 28. 2010 11 21
  • 29. emitter.on(‘event’,callback); // bind emitter.emit(‘event’); // trigger $(‘div’).bind(‘event’,callback); $(‘div’).trigger(‘event’); 2010 11 21
  • 30. 2010 11 21
  • 31. 2010 11 21
  • 32. 2010 11 21
  • 33. 2010 11 21
  • 34. 2010 11 21
  • 35. var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('The World!!n'); }).listen(8124); console.log('Server running at http://127.0.0.1:8124/'); 2010 11 21
  • 36. 2010 11 21
  • 37. 2010 11 21
  • 38. var socketio = require('socket.io'); var io = socketio.listen(server); io.on('connection', function(client) { // client.on('message', function(message) { // // //message client.send(message); // client.broadcast(message); // }); }); 2010 11 21
  • 39. $(function() { var socket = new io.Socket(null, {port: 8080}); socket.connect(); $('#button').click(function() { // socket.send('message'); return false; }); socket.on('message', function(obj) { // $('#output').text(obj); }); }); 2010 11 21
  • 40. 2010 11 21
  • 41. 2010 11 21
  • 42. 2010 11 21
  • 43. 2010 11 21
  • 44. 2010 11 21
  • 45. 2010 11 21