简体   繁体   中英

Run NodeJS app on appFog

All I want to do is deploy my little nodeJS app onto the free hosting site, appFog. Nomatter what ports I set on my client side or on my server side.. I consistently get the error message:

events.js:71

throw arguments[1]; // Unhandled 'error' event

^ Error: listen EADDRINUSE

When this is on my laptop / desktop running on localhost, everything works just fine.

So this is what I've got going on:

Client side:

this.connection = new WebSocket('ws://super1onate.aws.af.cm:1337');

Server Side:

var express = require("express"); // load the express module 
var app = express(); // App now holds the server object

// What ports to listen on 
app.listen(process.env.VCAP_APP_PORT ||1337);  

server.listen(process.env.VCAP_APP_PORT || 1337, function() {
     console.log((new Date()) + " Server is listening on port " + webSocketsServerPort); });

Your server code looks ok. What is events.js? It looks like maybe you're including a module that's trying to bind to a port it shouldn't.

Once you get your server running, I don't think your client code will work. As far as I can tell, AppFog doesn't support websockets, and if it does, you'll probably want to hit port 80, not 1337.

Alright, I'm going to answer my own questions.

AppFog does not support WebSockets. websockets =/= socket.io btw fyi

Anyways, according to this site: http://feedback.appfog.com/forums/171983-appfog/suggestions/3543100-add-websocket-support-to-node-js

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM