SANDBOX

Real Time w/ Nodejs

This experiment was a fun chance to brush up on React and tinker with real-time data via Node.js. In this test, I'm using sockets.io for the real-time connection but we can also accomplish something similar with Node's built-ins.


// create the server
const server = require('net').createServer()

// listen for incoming
server.on('connection', socket => {

  socket.on('data', data => {
    // data stuff
  })
  socket.on('end', () => {
    // disconnect
  })
})

server.listen(8000, () => console.log('Bueller...'))
NodejsReactjsTypeScript