WebSocketサーバを使ってみよう! Jul 2011

3,137 views

Published on

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

No Downloads
Views
Total views
3,137
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
22
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • HTML5では、サイトの機能を表現するためのバッジが配布されています。接続性、CSS3、デバイスアクセス、3Dグラフィックス、エフェクト、マルチメディア、パフォーマンス、統合、意味論、オフライン、ストレージ。WebSocketをこれらになぞらえると、次のようになります。\n
  • 接続性の提供、パフォーマンス、統合に寄与する、といえます。\n
  • \n
  • \n
  • \n
  • \n
  • では、これらの機能に実際に触れてみましょう\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • では、デモで使った機能について解説していきます\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • WebSocketは目立たない存在です。裏方しごとといったところでしょうか。ご存知の方もいらっしゃると思いますが、WebSocketの探し方を説明したいと思います。\n
  • Googleのブラウザ、クロームも場合です。\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • WebSocketサーバを使ってみよう! Jul 2011

    1. 1. WebSocket July 2011 1
    2. 2. http://j.mp/ws201107 2
    3. 3. MiCHiLU Labs.ENDOH takanao 3
    4. 4. 4
    5. 5. WebSocket 5
    6. 6. WebSocket 6
    7. 7. HTML5• •• CSS3 •• •• 3D • 7
    8. 8. WebSocket•• 8
    9. 9. WebSocketshirasu.ws WebSocket 9
    10. 10. shirasu.ws• https://github.com/michilu/shirasu• Misultin HTTP• Erlang 10
    11. 11. shirasu.ws• Fedora Linux RPM Red Hat Enterprise Linux• YAML• 11
    12. 12. shirasu.ws• path path• HTTP HTTP• HTTP GET HTTP WebSocket 12
    13. 13. 13
    14. 14. • Fedora 14 Amazon EC2• Shirasu WebSocket 14
    15. 15. Amazon EC2• AWS• AWS• Fedora 14• ssh 15
    16. 16. AWS• AWS http://j.mp/r3KAwO 16
    17. 17. AWS• EC2 US East EC2 Dashboard Launch Instance 17
    18. 18. AWS• Request Instances Wizard My AMIs 18
    19. 19. AWS• “ami-669f680f” Select 19
    20. 20. AWS• INSTANCE DETAILS Continue 20
    21. 21. AWS• INSTANCE DETAILS Continue 21
    22. 22. AWS• INSTANCE DETAILS Continue 22
    23. 23. AWS• Key Pair Key Pair 23
    24. 24. AWS• pem 24
    25. 25. AWS• CONFIGURE FIREWALL Continue 25
    26. 26. AWS• REVIEW Continue 26
    27. 27. AWS• Close 27
    28. 28. AWS• EC2 Instances 28
    29. 29. AWS• Public DNS 29
    30. 30. AWS• Security Groups default TCP Port/8000 30
    31. 31. • 31
    32. 32. • pem$ chmod 600 ~/Downloads/shirasu.pem 32
    33. 33. • AWS ssh$ ssh -i ~/Downloads/shirasu.pem ec2-user@ec2-****.compute-1.amazonaws.com…Are you sure you want to continue connecting(yes/no)? yes 33
    34. 34. • AWS ssh…Appliance: fedora-14 appliance 1.0Hostname: ip-10-203-13-209IP Address: 10.203.13.209[ec2-user@ip-10-203-13-209 ~]$ 34
    35. 35. Amazon EC2• shirasu RPM•• shirasu 35
    36. 36. • shirasu RPMEC2$ curl -O -L http://j.mp/nv9UYI 36
    37. 37. • rpmEC2$ rpm --test -ivh shirasu-0.1.2-1.fc14.i386.rpmerror: Failed dependencies: PyYAML is needed by shirasu-0.1.2-1.fc14.i386 erlang-misultin is needed by shirasu-0.1.2-1.fc14.i386 erlang-mochiweb is needed by shirasu-0.1.2-1.fc14.i386 erlang-sasl is needed by shirasu-0.1.2-1.fc14.i386 37
    38. 38. • yumEC2$ sudo yum install -y PyYAML erlang-misultin erlang-mochiweb erlang-sasl…Complete! 38
    39. 39. • rpm shirasuEC2$ sudo rpm -ivh shirasu-0.1.2-1.fc14.i386.rpmPreparing... ########################################### [100%] 1:shirasu ########################################### [100%] 39
    40. 40. Amazon EC2• shirasu• WebSocket• shirasu• shirasu 40
    41. 41. • shirasuEC2$ sudo service shirasu startStarting Shirasu: [ OK ] 41
    42. 42. WebSockethttp://ec2-*.compute-1.amazonaws.com:8000/index.html 42
    43. 43. 1. Chat• Connect 43
    44. 44. 1. Chat• Send 44
    45. 45. 2. Exchange Chart• vs 45
    46. 46. 3. Twitter Streaming • shirasuEC2$ sudo vi /etc/shirasu/shirasu.yaml 46
    47. 47. 3. Twitter Streaming • <SCREEN_NAME> <PASSWORD>...shirasu_http_stream: /stream.twitter.com/1/statuses/sample.json:"http://<SCREEN_NAME>:<PASSWORD>@stream.twitter.com/1/statuses/sample.json" /exchange/USDJPY: - "http://chartapi.finance.yahoo.com/instrument/1.0/USDJPY=X/chartdata;type=quote;range=2d/csv/" 47
    48. 48. 3. Twitter Streaming • shirasuEC2$ sudo service shirasu reloadReloading Shirasu: [ OK ] 48
    49. 49. 3. Twitter Streaming• Twitter Streaming API WebSocket 49
    50. 50. • shirasuEC2$ sudo service shirasu stopStopping Shirasu: [ OK ] 50
    51. 51. 51
    52. 52. 1. Chat52
    53. 53. 1. Chat• shirasu• path ws://host:8000/chat• “/chat” path• path 53
    54. 54. 1. ChatServer Clients client 1/path client 2 /foo client 3 54
    55. 55. 2. Exchange Chart 55
    56. 56. 2. Exchange Chart• HTTP GET• HTTP CSV WebSocket• http://chartapi.finance.yahoo.com/ chartapi.finance.yahoo.cominstrument/1.0/ USDJPY=X/ chartdata;type=quote;range=2d/csv/ 56
    57. 57. 2. Exchange Chart Server Clients HTTP GETCSV client 1 /exchange client 2 57
    58. 58. 3. Twitter Streaming 58
    59. 59. 3. Twitter Streaming• HTTP GET• HTTP HTTP WebSocket• http:// <SCREEN_NAME>:<PASSWORD>@ stream.twitter.com/1/statuses/sample.json 59
    60. 60. 3. Twitter Streaming Server ClientsTwitter Streaming API / HTTP client 1 /twitter client 2 60
    61. 61. HTTP GET • shirasu_http_stream/etc/shirasu/shirasu.yaml…shirasu_http_stream: <path1>: <URL1> <path2>: - <URL1> - <URL2> 61
    62. 62. • shirasu_http_serve/etc/shirasu/shirasu.yaml…shirasu_http_serve: <path>: <directory path> 62
    63. 63. shirasu • shirasu listen port/etc/shirasu/shirasu.yaml…shirasu: listen: port: 8000 63
    64. 64. Amazon EC2• AWS• 64
    65. 65. AWS• AWS http://j.mp/r3KAwO 65
    66. 66. AWS• EC2 Instance Instance Action Terminate 66
    67. 67. WebSocket 67
    68. 68. WebSocket1. Google Chrome2.3. 68
    69. 69. WebSocket1. Network2. WebSocket 69
    70. 70. WebSocket 70
    71. 71. • WebSocket EC2•• shirasu• shirasu 71
    72. 72. WebSocket.JPhttp://websocket.jp WebSocket 72
    73. 73. http://j.mp/o5jxmI 73

    ×