Skip to content

Commit

Permalink
fixed the startup of the ws server and tcp server
Browse files Browse the repository at this point in the history
  • Loading branch information
prgsmall committed Apr 23, 2012
1 parent be16511 commit f00c758
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 17 deletions.
9 changes: 1 addition & 8 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
var acequia = require('./lib/acequia');

var start = function () {
var acequiaServer = acequia.createServer();
acequiaServer.start();
};

start();
module.exports = require('./lib/acequia');
10 changes: 3 additions & 7 deletions lib/acequia.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ var acequiaClients = null;

function AcequiaServer(options) {

if (typeof(options) === "undefined") {
options = {};
}

this.options = Object.extend({
ipAddress: "0.0.0.0",
oscPort: 9090,
Expand Down Expand Up @@ -60,7 +56,7 @@ AcequiaServer.prototype.start = function () {
this.wsServer = this.createWSServer();
}

if (this.tcpPort) {
if (this.options.tcpPort) {
this.tcpServer = this.createTCPServer();
}
};
Expand Down Expand Up @@ -159,7 +155,7 @@ AcequiaServer.prototype.createTCPServer = function () {
}
});

tcpServer.listen(this.options.tcpServer, this.options.ipAddress);
tcpServer.listen(this.options.tcpPort, this.options.ipAddress);

return tcpServer;
};
Expand Down Expand Up @@ -193,7 +189,7 @@ AcequiaServer.prototype.createWSServer = function () {
logger.debug(" WS Server is listening on [%s:%s]", this.address().address, this.address().port);
});

httpServer.listen(this.wsPort);
httpServer.listen(this.options.wsPort);

// Create the socket io server and attach it to the httpServer
wsServer = require('socket.io').listen(httpServer);
Expand Down
2 changes: 1 addition & 1 deletion lib/genclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var concatenateClientFiles = function () {
var buffer, code = "", fd, stats, i, size = 0, file, files = ["msg.js", "acequiaClient.js"];

for (i in files) {
file = process.cwd() + "/lib/" + files[i];
file = __dirname + "/" + files[i];
stats = fs.statSync(file);
buffer = new Buffer(stats.size);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ "name" : "acequia"
, "version" : "0.1.0"
, "description":"Message router for node supporting multiple protocols"
, "main": "index.js"
, "main": "server.js"
, "preferGlobal": "true"
, "directories": {"lib": "./lib" }
, "scripts": { "start": "node ." }
Expand Down
8 changes: 8 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var acequia = require('./lib/acequia');

var start = function () {
var acequiaServer = acequia.createServer();
acequiaServer.start();
};

start();

0 comments on commit f00c758

Please sign in to comment.