Socket.io with PubNub...why? -


i see pubnub support socket.io - http://blog.pubnub.com/node-js-supercharged-by-pubnub/#socket.io-github

can explain me going on here because thought pubnub serves same purpose socket.io in both abstraction layer realtime messaging. on github page says makes socket.io faster why integrating platform in first place?

this seems me microsoft windows saying support linux. , if use linux powered windows you'll have faster linux. i.e. it's ridiculous proposition.

so reason using socket.io pubnub, why not use pubnub on own?

socket.io on pubnub network

pubnub , socket.io 2 separate technologies, independent yet connected open mobile web.

pubnub data streaming network

pubnub globally distributed data stream network. available simple primitives make real-time service possible high reliability , globally distributed data centers.

socket.io realtime framework

socket.io framework abstracted concepts make network communication little more robust great features , use patterns make easy. consider socket.io networking jquery html/javascript. pubnub tcp socket cloud. socket.io framework has design patterns. socket.io nice framework on top of pubnub gives pretty great , easy-to-use design patterns. socket.io has server-component written in node.js requires host own cluster of servers operate. putting socket.io on pubnub removes need operate , run own server cluster.

also consider socket.io sdk pubnub designed people started socket.io want migrate pubnub. otherwise, there no requirement use socket.io library if starting pubnub first.

pubnub removes need server back-end can focus on building apps.

also familiar socket.io api able port existing javascript-based socket.io code directly onto pubnub - https://github.com/pubnub/javascript/tree/master/socket.io#how-to-use

socket.io started quickly

socket.io allows emit , receive custom events. reserved events are: connect, message, disconnect, reconnect, ping, join , leave.

sending , receiving events.

<script src="http://cdn.pubnub.com/socket.io.min.js"></script> <script> (function(){      // important: pubnub setup api keys     var pubnub_setup = {         channel       : 'my_mobile_app',         publish_key   : 'demo',         subscribe_key : 'demo'     };      var socket = io.connect( 'http://pubsub.pubnub.com', pubnub_setup );      socket.on( 'connect', function() {         console.log('connection established! ready send/receive data!');         socket.send('my message here');         socket.send(1234567);         socket.send([1,2,3,4,5]);         socket.send({ apples : 'bananas' });     } );      socket.on( 'message', function(message) {         console.log(message);     } );      socket.on( 'disconnect', function() {         console.log('my connection dropped');     } );      // event in socket.io provided pubnub     socket.on( 'reconnect', function() {         console.log('my connection has been restored!');     } );  })(); </script> 

Comments