Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Socket.IO in Chess Realtime Multiplayer Web App...

Socket.IO in Chess Realtime Multiplayer Web Application

Conferences Box

November 30, 2012
Tweet

More Decks by Conferences Box

Other Decks in Technology

Transcript

  1. NODE.JS ( Server ) var io = require('socket.io').listen(80); io.sockets.on('connection', function

    (socket) { socket.emit('news', { hello: 'world' }); socket.on('my other event', function (data) { console.log(data); }); });
  2. NODE.JS ( Server ) var io = require('socket.io').listen(80); io.sockets.on('connection', function

    (socket) { socket.emit('news', { hello: 'world' }); socket.on('my other event', function (data) { console.log(data); }); });
  3. NODE.JS ( Server ) var io = require('socket.io').listen(80); io.sockets.on('connection', function

    (socket) { socket.emit('news', { hello: 'world' }); socket.on('my other event', function (data) { console.log(data); }); });
  4. Browser ( Javascript ) <script src="/socket.io/socket.io.js"></script> <script> var socket =

    io.connect('http://localhost'); socket.on('news', function (data) { console.log(data); socket.emit('my other event', { my: 'data' }); }); </script>
  5. Browser ( Javascript ) <script src="/socket.io/socket.io.js"></script> <script> var socket =

    io.connect('http://localhost'); socket.on('news', function (data) { console.log(data); socket.emit('my other event', { my: 'data' }); }); </script>
  6. Browser ( Javascript ) <script src="/socket.io/socket.io.js"></script> <script> var socket =

    io.connect('http://localhost'); socket.on('news', function (data) { console.log(data); socket.emit('my other event', { my: 'data' }); }); </script>
  7. Socket.IO + Express var app = require('express')() , server =

    require('http').createServer(app) , io = require('socket.io').listen(server); server.listen(80); app.get('/', function (req, res) { res.sendfile(__dirname + '/index.html'); }); io.sockets.on('connection', function (socket) { socket.emit('news', { hello: 'world' }); socket.on('my other event', function (data) { console.log(data); }); });
  8. C++, Objective C, Ruby, Python, Erlang, Lua, Perl, Go, PHP

    ... and many more. Unofficial server side implementations
  9. Desktop Internet Explorer 5.5+ ! Safari 3+ Google Chrome 4+

    Firefox 3+ Opera 10.61+ Mobile iPhone Safari iPad Safari Android WebKit WebOs WebKit Browser Support