Qiscus TechTalk - Real-time Website with Node.js (socket.io)

Post on 20-Aug-2015

546 views 2 download

Tags:

Transcript of Qiscus TechTalk - Real-time Website with Node.js (socket.io)

Socket.io dan NodeTech Talk JDV. 2014

Selamat Sore~

Rifqi Alfian@merembablasmootuts.com

Freelancermerembablas@gmail.com

Apa itu Node, enak ga?

Node : Non Blocking I/O

sumber img : https://strongloop.com

Node : Tidak hanya platform, namun juga module

sumber img : https://strongloop.com

Tentang Node

Tanya dong mas...

Web Socket

1. Cross Origin Communication2. Proxy, Firewall problem3. Open Connection, High Concurrency + Low

Cost

Web Socket

sumber img : http://www.websocket.org/

Request

Response

Socket.io : Fitur

1. Mekanisme ‘Fallback’2. Room3. Namespace4. Authentifikasi

Socket.io : KonfigurasiMekanisme Fallback :

io.set('transports', [ 'websocket' , 'flashsocket' , 'htmlfile' , 'xhr-polling' , 'jsonp-polling' ]);

Socket.io : Authentifikasi

1. Global dan Namespace2. HanshakeData{ headers: req.headers // <Object> the headers of the request , time: (new Date) +'' // <String> date time of the connection , address: socket.address() // <Object> remoteAddress and remotePort object , xdomain: !!headers.origin // <Boolean> was it a cross domain request? , secure: socket.secure // <Boolean> https connection , issued: +date // <Number> EPOCH of when the handshake was created , url: request.url // <String> the entrance path of the request , query: data.query // <Object> the result of url.parse().query or a empty object}

Demo Socket.io

Lihat dong mas...

Terima Kasih

mootuts.commerembablas@gmail.com