18
@diego_pacheco Software Architect | Agile Coach

Socket.io

Embed Size (px)

DESCRIPTION

socket, socket.io, node.js, nodejs, js

Citation preview

Page 1: Socket.io

@diego_pachecoSoftware Architect | Agile Coach

Page 2: Socket.io
Page 3: Socket.io

Lars BakHotSpot(20x faster)

Assembler

JIT

Threads

Page 4: Socket.io
Page 5: Socket.io

non-blocking i/o VS blocking i/o

Page 6: Socket.io

Http,Tcp,File Bindings

Evented I/O

Good Speed(Performance)

Good for concurrency

Everything Asynchronous

JS Server Side

Runs on Google V8

Supports for Redis & MongoDB

Real time apps with WebSockets(html 5)

Ruby's Event Machine or Python's Twisted

Page 7: Socket.io

Why Socket.io? Why Not WebSockets?

Page 8: Socket.io

Transparent Transport API

Authorization

Timeouts

Heartbeats / Disconnection

Cross Browser + Mobile/Tablets

Reconnection + Buffering

Multiple Sockets with same connection

Modules (session, logger, node2node, mq)

Features

Page 9: Socket.io

Multi-Transport Socket for

Page 10: Socket.io

WebSocket

Adobe® Flash® Socket

AJAX long polling

AJAX multipart streaming

Forever Iframe

JSONP Polling

Select the best transport option:

Page 11: Socket.io

[server.js]

Page 12: Socket.io

[index.html]

Page 13: Socket.io

$ node server.jsinfo - socket.io starteddebug - client authorizedinfo - handshake authorized 10976962382111866647debug - setting request GET /socket.io/1/websocket/10976962382111866647debug - set heartbeat interval for client 10976962382111866647debug - client authorized fordebug - websocket writing 1::debug - websocket writing 5:::{"name":"news","args":[{"hello":"world"}]}

{ my: 'data' }

Page 14: Socket.io

[calc.html]

Page 15: Socket.io
Page 16: Socket.io
Page 17: Socket.io

$ node calc.jsinfo - socket.io starteddebug - client authorizedinfo - handshake authorized 19733746072008321086debug - setting request GET /socket.io/1/websocket/19733746072008321086debug - set heartbeat interval for client 19733746072008321086debug - client authorized fordebug - websocket writing 1::

doop event received.{ va: '10', vb: '21', op: '+' }

debug - websocket writing 5:::{"name":"result","args":[{"result":31}]}

Page 18: Socket.io

@diego_pachecoSoftware Architect | Agile Coach

Thank You!