Download - Comunicação em tempo real com Node.js
![Page 1: Comunicação em tempo real com Node.js](https://reader036.vdocuments.pub/reader036/viewer/2022062412/58eddb431a28ab66208b4615/html5/thumbnails/1.jpg)
Globalcode – Open4education
Node.js
Vinicius MussakMSP - MCP
Comunicação em tempo real com Node.js
![Page 2: Comunicação em tempo real com Node.js](https://reader036.vdocuments.pub/reader036/viewer/2022062412/58eddb431a28ab66208b4615/html5/thumbnails/2.jpg)
Globalcode – Open4education
Vinicius Mussak
Desenvolvo soluções/bugsMicrosoft Student PartnerMicrosoft Certified ProfessionalEstudo Sistemas de Informação
![Page 3: Comunicação em tempo real com Node.js](https://reader036.vdocuments.pub/reader036/viewer/2022062412/58eddb431a28ab66208b4615/html5/thumbnails/3.jpg)
Globalcode – Open4education
http://tdc-chat.azurewebsites.net
![Page 4: Comunicação em tempo real com Node.js](https://reader036.vdocuments.pub/reader036/viewer/2022062412/58eddb431a28ab66208b4615/html5/thumbnails/4.jpg)
Globalcode – Open4education
“Nossos clientes precisam de informação agora!”
![Page 5: Comunicação em tempo real com Node.js](https://reader036.vdocuments.pub/reader036/viewer/2022062412/58eddb431a28ab66208b4615/html5/thumbnails/5.jpg)
Globalcode – Open4education
Sério mesmo?
![Page 6: Comunicação em tempo real com Node.js](https://reader036.vdocuments.pub/reader036/viewer/2022062412/58eddb431a28ab66208b4615/html5/thumbnails/6.jpg)
Globalcode – Open4education
Comunicação em tempo real
![Page 7: Comunicação em tempo real com Node.js](https://reader036.vdocuments.pub/reader036/viewer/2022062412/58eddb431a28ab66208b4615/html5/thumbnails/7.jpg)
Globalcode – Open4education
Quem usa?
![Page 8: Comunicação em tempo real com Node.js](https://reader036.vdocuments.pub/reader036/viewer/2022062412/58eddb431a28ab66208b4615/html5/thumbnails/8.jpg)
Globalcode – Open4education
Socket IO
“Socket.IO enables real-time bidirectional event-based communication.”
“It works on every platform, browser or device, focusing equally on reliability and speed.”
![Page 9: Comunicação em tempo real com Node.js](https://reader036.vdocuments.pub/reader036/viewer/2022062412/58eddb431a28ab66208b4615/html5/thumbnails/9.jpg)
Globalcode – Open4education
SIMPLICIDADE
![Page 10: Comunicação em tempo real com Node.js](https://reader036.vdocuments.pub/reader036/viewer/2022062412/58eddb431a28ab66208b4615/html5/thumbnails/10.jpg)
Globalcode – Open4education
WebSocketsFlashSocketsAJAX long pollingAJAX multipart streaming (até versão 0.7)Forever IframeJSONP Polling
Socket IO
![Page 11: Comunicação em tempo real com Node.js](https://reader036.vdocuments.pub/reader036/viewer/2022062412/58eddb431a28ab66208b4615/html5/thumbnails/11.jpg)
Globalcode – Open4education
Quem usa Socket IO?
![Page 12: Comunicação em tempo real com Node.js](https://reader036.vdocuments.pub/reader036/viewer/2022062412/58eddb431a28ab66208b4615/html5/thumbnails/12.jpg)
Globalcode – Open4education
Basicamente,ouvimos e transmitimos
![Page 13: Comunicação em tempo real com Node.js](https://reader036.vdocuments.pub/reader036/viewer/2022062412/58eddb431a28ab66208b4615/html5/thumbnails/13.jpg)
Globalcode – Open4education
Ouvimos
socket.on("mensagem", function(msg){ //alguma coisa});
![Page 14: Comunicação em tempo real com Node.js](https://reader036.vdocuments.pub/reader036/viewer/2022062412/58eddb431a28ab66208b4615/html5/thumbnails/14.jpg)
Globalcode – Open4education
Transmitimos
socket.emit("mensagem", "Olá TDC!");
![Page 15: Comunicação em tempo real com Node.js](https://reader036.vdocuments.pub/reader036/viewer/2022062412/58eddb431a28ab66208b4615/html5/thumbnails/15.jpg)
Globalcode – Open4education
Transmitimos
socket.broadcast.emit("mensagem", "Olá TDC!");
![Page 16: Comunicação em tempo real com Node.js](https://reader036.vdocuments.pub/reader036/viewer/2022062412/58eddb431a28ab66208b4615/html5/thumbnails/16.jpg)
Globalcode – Open4education
Concluindo…
Você simplesmente envia uma mensagem (emit) para algúem esteja aguardando por ela (on)
![Page 17: Comunicação em tempo real com Node.js](https://reader036.vdocuments.pub/reader036/viewer/2022062412/58eddb431a28ab66208b4615/html5/thumbnails/17.jpg)
Globalcode – Open4education
DemoConstruindo um chat
![Page 18: Comunicação em tempo real com Node.js](https://reader036.vdocuments.pub/reader036/viewer/2022062412/58eddb431a28ab66208b4615/html5/thumbnails/18.jpg)
Globalcode – Open4education
http://socket.io/ Site do socket.io
https://github.com/socketio/socket.io GitHub
https://developer.mozilla.org/pt-BR/docs/WebSockets Web Sockets
Para saber mais!
![Page 19: Comunicação em tempo real com Node.js](https://reader036.vdocuments.pub/reader036/viewer/2022062412/58eddb431a28ab66208b4615/html5/thumbnails/19.jpg)
Globalcode – Open4education
Dúvidas?
![Page 20: Comunicação em tempo real com Node.js](https://reader036.vdocuments.pub/reader036/viewer/2022062412/58eddb431a28ab66208b4615/html5/thumbnails/20.jpg)
Globalcode – Open4education
Obrigado!
viniciusmussak.net
/viniciusmussak
/viniciusmussak
@ViniciusMussak
/vmussak