Skip to content

32 Socket.io

Jagdeep Singh edited this page Jun 29, 2019 · 1 revision

What is Socket.io?

  • Keeps a pipe open between client and server
  • Keeps communication pathway open
  • Responds to events that one side or the other emits
  • Publish an Event socket.emit('run', tellEveryoneToRun)
  • Respond to an Event socket.on('run', doTheRunningMan)
  • On the React side, you can respond to an event and add it's payload to state, or use a state change to trigger an emit

Clone this wiki locally