I'm using NodeJS with express to create a Websocket application with WS on EC2(Ubuntu). I have the following code:
var WebSocketServer = require('ws').Server , wss = new WebSocketServer({ port: 8090 }); wss.on('connection', function connection(ws) { ws.on('message', function incoming(message) { console.log('received: %s', message); }); ws.send('something'); }); Also, I added a "custom tcp rule" to the port 8090 and anywhere(0.0.0.0/0)
After I run: wscat --connect http://myipaddress:8090
I got: error: Error: connect ECONNREFUSED myipaddress:8090
Am I forgetting something in Ec2 Configuration or code?
Greetings
http://myipaddress:8090but it should bews://myipaddress:8090