Study Group: 內湖澄鵡 出品 webSockets
Tags: 讀書會
What are websockets?
- Communication between a client (browser) and server
- Bidirectional (data flows both ways)
-
Allows real-time data flow
- wiki:
-
WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection. The WebSocket protocol was standardized by the IETF as RFC 6455 in 2011, and the WebSocket API in Web IDL is being standardized by the W3C.
-
中文: WebSocket是一種網路傳輸協定,可在單個TCP連接上進行全雙工通訊,位於OSI模型的應用層。WebSocket協定在2011年由IETF標準化為RFC 6455,後由RFC 7936補充規範。Web IDL中的WebSocket API由W3C標準化。WebSocket使得客戶端和伺服器之間的資料交換變得更加簡單,允許伺服器端主動向客戶端推播資料。在WebSocket API中,瀏覽器和伺服器只需要完成一次交握,兩者之間就可以建立永續性的連接,並進行雙向資料傳輸。
-
uses of websockets
- multiplayer browser games
- collaborative code editing
- live text for sports/news websites
- online drawing canvas
- real-time to-do apps with multiple users
快樂來實作~
-
docker container run --rm -p 80:4000 tim23656/web-socket
-
github: https://github.com/iamshaunjp/websockets-playlist/tree/master
- 可以先 抓到本G來玩玩看,他每個 branch 都是一堂課。想 clone 最終版
git clone --branch lesson-5 https://github.com/iamshaunjp/websockets-playlist.git
- 可以先 抓到本G來玩玩看,他每個 branch 都是一堂課。想 clone 最終版
npm install
- npm install express socket.io –save
- npm install nodemon –save-dev
reference
-
WebSockets (using Socket.io) Tutorial #1 - What Are WebSockets?
-
WebSockets (using Socket.io) Tutorial #2 - Creating an Express App
-
WebSockets (using Socket.io) Tutorial #3 - Using Socket.io
-
WebSockets (using Socket.io) Tutorial #4 - Emitting Messages
-
WebSockets (using Socket.io) Tutorial #5 - Broadcasting Messages
BONUS: OKR
-
John Doerr on OKRs and Goal Setting at Google and Intel
-
Why the secret to success is setting the right goals John Doerr