Skip to content

Commit

Permalink
Fixed up the client side to use the window.location.port to connect to
Browse files Browse the repository at this point in the history
Removed mdns from package.json
Changed minification to a server option, rather than a path.
  • Loading branch information
prgsmall committed Jul 10, 2012
1 parent 269d59d commit a41748a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 45 deletions.
10 changes: 5 additions & 5 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Acequia TODO
------------

Add namespace to the message object

OSCClient.prototype.send = function (message) {
// TODO: convert the message to an OSC message

Define OSC messages for connect/disconnect, etc.

rename the msg module to something else.
rename the msg module to something else.

Add mdns back to package.json
, "mdns" : ">=0.0.7"

31 changes: 19 additions & 12 deletions lib/acequia.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ var acequiaClients = null;
function AcequiaServer(options) {

this.options = Object.extend({
ipAddress: "0.0.0.0",
oscPort: 9090,
wsPort: 9091,
tcpPort: 9092,
timeout: 600000,
express_app: null,
enableDiscovery: true
ipAddress: "0.0.0.0"
, oscPort: 9090
, wsPort: 9091
, tcpPort: 9092
, timeout: 600000
, express_app: null
, minify_client: true
, enableDiscovery: true
}, options || {});

this.acequiaClients = new ac.AcequiaClients(this.options.timeout * 1000);
Expand Down Expand Up @@ -252,7 +253,7 @@ AcequiaServer.prototype.createTCPServer = function () {
* @return the socket.io server
*/
AcequiaServer.prototype.createWSServer = function () {
var clientCode, httpServer, io, app;
var clientCode, io, app;

if (!clientCode) {
// Generate the client code
Expand All @@ -263,7 +264,11 @@ AcequiaServer.prototype.createWSServer = function () {
this.options.express_app = express.createServer();
this.options.express_app.listen(this.options.wsPort);
}
app = this.options.express_app;
app = this.options.express_app;

// Add the acequiaServer instance to the web app, so it has acess to its
// options
app.acequiaServer = this;

app.configure(function(){
app.use(express.methodOverride());
Expand All @@ -280,9 +285,11 @@ AcequiaServer.prototype.createWSServer = function () {
};

if (pathName === "/acequia/acequia.js") {
serveClientCode(clientCode.full);
} else if (pathName === "/acequia/acequia.min.js") {
serveClientCode(clientCode.minified);
if (app.acequiaServer.options.minify_client) {
serveClientCode(clientCode.minified);
} else {
serveClientCode(clientCode.full);
}
} else {
res.statusCode = 404;
res.send("Page Not Found:" + req.url);
Expand Down
2 changes: 1 addition & 1 deletion lib/acequiaClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var AcequiaClient = function (clientName, uri) {
* @returns {String} the URI
*/
AcequiaClient.prototype.getURI = function (uri) {
var port = 9091, i;
var port = window.location.port, i;

if (typeof(uri) !== "undefined") {
i = parseInt(uri, 10);
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
, "engines": { "node": ">=0.6" }
, "dependencies" :
{ "log4js" : ">=0.4.1"
, "express": "2.5.8"
, "express": ">=2.5.8"
, "socket.io": ">=0.9.6"
, "socket.io-client":">=0.9.6"
, "uglify-js": ">=1.2.5"
, "mdns" : "0.0.x"
, "buffertools" : ">=1.0.9"
}
, "homepage": "https://github.com/prgsmall/acequia"
Expand Down
25 changes: 0 additions & 25 deletions test/client.html

This file was deleted.

0 comments on commit a41748a

Please sign in to comment.