ds7-ds / Model-Airport

An operational 1/500 model airport with lights and sound.
https://model-airport.herokuapp.com
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Software Engineering: WebSockets Server Cannot Be Instantiated #38

Closed ds7-ds closed 4 years ago

ds7-ds commented 4 years ago

WebSocket Error 2

When trying to instantiate a WebSocket server, I get a message saying that the port is already in use. Before, I used port 8080 as it was shown in the example and it worked in local but not in production.

ds7-ds commented 4 years ago

Tried removing the port and this error popped up:

WebSocket Error

Confused why the port option didn't work. Reading docs plus examples and trying the server option.

ds7-ds commented 4 years ago

The server option required an instance of express, so I transferred the code to the main app to see if the error would be resolved. The server code works now, but the webpage cannot seem to connect.

ds7-ds commented 4 years ago

After reading the Heroku docs on WebSockets. No port or http server instance was created yet the app is listening on some port! The code for that was somewhere inside the bin folder. Transferred the code there under the instance and code finally works. IntelliJ automated NodeJS Express project and so I didn't realize no HTTP server was ever made in app.js.