0
SockJS Intro               Ngoc Dao
Do you know WebSocket?
WebSocket<script>var sock = new WebSocket(ws://domain/my_prefix);sock.onopen = function() {  console.log(open);};sock.onme...
WebSocket    New browsers are required:●   Internet Explorer: 10●   Firefox: 6●   Chrome: 4●   Safari: 5●   Opera: 12.10
SockJS●   Provides WebSocket-like API●   Supports all browsers, e.g. IE 6●   Transports: websocket xhr-streaming xdr-    s...
WebSocket vs SockJSWebSocket                                        SockJS<script>                                        ...
Links●   Client side:    <script src="http://cdn.sockjs.org/sockjs-0.3.min.js"></script>    https://github.com/sockjs/sock...
Links●   Client side:    <script src="http://cdn.sockjs.org/sockjs-0.3.min.js"></script>    https://github.com/sockjs/sock...
Demohttps://github.com/sockjs/sockjs-node/tree/master/examples/echogit clone git://github.com/sockjs/sockjs-node.gitcd soc...
SockJS protocolIf you want to implement a server side for SockJS,or just want to know how SockJS works:https://github.com/...
SockJS vs Socket.IO●   Socket.IO ≈ SockJS + α●   SockJS is way simpler, closer to WebSocket    => SockJS has lots of serve...
Upcoming SlideShare
Loading in...5
×

SockJS Intro

11,157

Published on

4 Comments
11 Likes
Statistics
Notes
  • Basicly.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Cool introduction!

    BTW:
    * Performance - it's surprisingly good (for example: http://mrjoes.github.com/2012/10/11/sockjs-ejabberd.html )

    * Security - SockJS gives you a connection abstraction, that can be established cross-domain. It's the application responsibility to authenticate it, but it's not hard.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • That depends on each server side implementation. More info: https://github.com/sockjs/sockjs-node#various-issues-and-design-considerations
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • how about performance and security ?
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
11,157
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
87
Comments
4
Likes
11
Embeds 0
No embeds

No notes for slide

Transcript of "SockJS Intro"

  1. 1. SockJS Intro Ngoc Dao
  2. 2. Do you know WebSocket?
  3. 3. WebSocket<script>var sock = new WebSocket(ws://domain/my_prefix);sock.onopen = function() { console.log(open);};sock.onmessage = function(e) { console.log(message, e.data);};sock.onclose = function() { console.log(close); Server can push data}; to browsers when it wants</script>
  4. 4. WebSocket New browsers are required:● Internet Explorer: 10● Firefox: 6● Chrome: 4● Safari: 5● Opera: 12.10
  5. 5. SockJS● Provides WebSocket-like API● Supports all browsers, e.g. IE 6● Transports: websocket xhr-streaming xdr- streaming iframe-eventsource iframe-htmlfile xhr-polling xdr-polling iframe-xhr-polling jsonp- polling● Requires Client side: sockjs.js Server side: SockJS server side library
  6. 6. WebSocket vs SockJSWebSocket SockJS<script> <script>var sock = new WebSocket(ws://domain/my_ws); var sock = new SockJS(http://domain/my_prefix);sock.onopen = function() { sock.onopen = function() { console.log(open); console.log(open);}; };sock.onmessage = function(e) { sock.onmessage = function(e) { console.log(message, e.data); console.log(message, e.data);}; };sock.onclose = function() { sock.onclose = function() { console.log(close); console.log(close);}; };</script> </script>
  7. 7. Links● Client side: <script src="http://cdn.sockjs.org/sockjs-0.3.min.js"></script> https://github.com/sockjs/sockjs-client● Server side: Node.js: https://github.com/sockjs/sockjs-node Ruby: https://github.com/sockjs/sockjs-ruby Python: https://github.com/MrJoes/sockjs-tornado JVM: https://github.com/vert-x/vert.x https://github.com/ngocdaothanh/xitrum etc.
  8. 8. Links● Client side: <script src="http://cdn.sockjs.org/sockjs-0.3.min.js"></script> https://github.com/sockjs/sockjs-client● Server side: Node.js: https://github.com/sockjs/sockjs-node Ruby: https://github.com/sockjs/sockjs-ruby Python: https://github.com/MrJoes/sockjs-tornado JVM: https://github.com/vert-x/vert.x https://github.com/ngocdaothanh/xitrum etc.
  9. 9. Demohttps://github.com/sockjs/sockjs-node/tree/master/examples/echogit clone git://github.com/sockjs/sockjs-node.gitcd sockjs-node/examples/echonpm installnode server.js
  10. 10. SockJS protocolIf you want to implement a server side for SockJS,or just want to know how SockJS works:https://github.com/sockjs/sockjs-protocolhttp://sockjs.github.com/sockjs-protocol/sockjs-protocol-0.3.3.html
  11. 11. SockJS vs Socket.IO● Socket.IO ≈ SockJS + α● SockJS is way simpler, closer to WebSocket => SockJS has lots of server side implementations for many languages
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×