title: Websocket between two computers on same LAN network
body: <p>Is it possible to open a websocket between two computers that are either on the same WAN network or connected via an ethernet cable (LAN)? If it is, can someone provide with some readings I can do to learn about this?</p>
  
  <p><strong>EDIT:</strong> added my server code</p>
  
  <pre><code>'use strict';
  
  var express = require('express');  //web server
  var app = express();
  var server = require('http').createServer(app);
  var io = require('socket.io').listen(server);   //web socket server
  
  // ===============================Serial port setup========================
  var serialport = require('serialport');
  var SerialPort = serialport.SerialPort;
  var parsers = serialport.parsers;
  var openSocket = false;
  
  var port = new SerialPort("/dev/ttyACM0", {
      baudrate: 9600,
      parser: parsers.readline('\r\n')
  });
  
  // ===============================Server Setup===========================
  const netPort = 8080;
  server.listen(netPort); //start the webserver on port 8080
  app.use(express.static('public')); //tell the server that ./public/ contains 
  the static webpages
  console.log("listening on port: localhost:" + netPort);
  
  // ==============================Sending data======================
  io.sockets.on('connection', function (socket) {
      socket.emit('pi', { status: 'opened' });
      console.log('Socket is open'); // log to console, once serial connection is established
      openSocket = true;
  });
  
  port.on('data', function(data) {
      if (openSocket) {
              socket.emit('pi', {value: data}); //send data
      }
  });
  </code></pre>