Captainlonate
Captainlonate

Reputation: 5008

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); });

Upvotes: 2

Views: 983

Answers (2)

Captainlonate
Captainlonate

Reputation: 5008

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

Upvotes: 2

Trevor Dixon
Trevor Dixon

Reputation: 24382

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.

Upvotes: 2

Related Questions