Using the Elastic Beanstalk web console, I launched a new Web Server 1.0 environment with:
- Predefined Configuration: Node.js, 64bit Amazon Linux 2014.09 v1.0.9
- Type of medium: load balancing, autoscaling
and set the proxy server equal .
I successfully compressed and downloaded my code through the console:
package.json
{
"name": "cool",
"version": "0.0.0",
"dependencies": {
"ws": "0.4.x"
}
}
server.js
var wss = new (require('ws')).Server({port: (process.env.PORT || 3000)})
wss.on('connection', function(ws) {
console.log('connected')
ws.on('message', function(message) {
console.log(message)
ws.send(message)
});
ws.on('close', function() {
console.log('disconnected')
})
})
I also tried to include the directory node_modules.
After launch:
wscat -c ws://default-environment-xxxxxxxxxx.elasticbeatalk.com/
I returned:
Error: unexpected server response (200)
How to learn more about this error?
Amazon sets the PORT environment variable to 8080. So I also tried:
wscat -c ws://default-environment-xxxxxxxxxx.elasticbeatalk.com:8080/
But it just hung and then came back:
Error: connect ETIMEDOUT
, WebSocket, , , Heroku WebSocket, 60 .
, ?