beanstalk - Websocket client getting 200 response code -


I have a node server to serve both http and websuck at the same port setup works fine on the local host , But when Amazon is posted on Benstock (which has a LoadBaseless and NGNX), the WS Client throws an error while establishing a YS connection: "Unexpected response code 200" I'm not 100% sure about this, but I Seem to Because nodejs server errors as the http request in some way and thus gives 200. Here is the code for my server:

  var WebSocketServer = Required ('websocket'). Server; Var http = Required ('http'); Var FS = Requirement ('FS'); Var indexPage = "loading index page, try again later?"; Fs.readFile ('./ index.html', function (mistake, data) {indexPage = data;}) var server = http.createServer (function (request, response) {}); Server.listen (1337, work () {}); // server vs. server = create new web server ({httpServer: server}); // websseket server wsServer.on ('request', function (request) {console.dir (request); var connection = request.accept (blank, request.origin); console.log ("connect"); connection.on ('Message', function (message) {if (message.type === 'utf8') {console.log ("receive", message.utf8Data);}}) connection.on ('close', function ( Connection) {});});  

Any suggestions for me? In this case how can I configure nginx and load balancer?

Generally, they offer a supply of node.js hosting services that have dynamically your app Created at the end of the launch - this is normal:

  var port = process.env.PORT || 1337;  

Then when locally launches without env var, it uses your favorite 1337


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -