not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
490 B

  1. var app = require('express')();
  2. var http = require('http').Server(app);
  3. var io = require('socket.io')(http);
  4. const port = 3000;
  5. //Whenever someone connects this gets executed
  6. io.on('connection', function(socket) {
  7. console.log('A user connected');
  8. //Whenever someone disconnects this piece of code executed
  9. socket.on('disconnect', function () {
  10. console.log('A user disconnected');
  11. });
  12. });
  13. http.listen(port, function() {
  14. console.log('listening on *:3000');
  15. });