abelljs/abell

Use single port to run websocket and http server in abell-dev-server

Closed this issue · 1 comments

Is your feature request related to a problem? Please describe.
This has explaination of how abell-dev-server currently works #51

Describe the solution you'd like
I just realized both servers can run on same port.

This is the example from ws library

const fs = require('fs');
const https = require('https');
const WebSocket = require('ws');

const server = https.createServer({
  cert: fs.readFileSync('/path/to/cert.pem'),
  key: fs.readFileSync('/path/to/key.pem')
});
const wss = new WebSocket.Server({ server });

wss.on('connection', function connection(ws) {
  ws.on('message', function incoming(message) {
    console.log('received: %s', message);
  });

  ws.send('something');
});

server.listen(8080);

Additional context

src/abell-dev-server has the server.js and http-serve.js. server.js file has code to start a websocket server and send reload command to http server and http-serve.js file runs a http server.

Resolved in #55