Skip to content

Commit

Permalink
Various changes to the example and handling code in the Connection.
Browse files Browse the repository at this point in the history
  • Loading branch information
miksago committed Nov 11, 2010
1 parent 11f03ad commit 7ac5b74
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
8 changes: 2 additions & 6 deletions examples/echo-server.js
@@ -1,11 +1,7 @@
var sys = require("sys")
, ws = require('../lib/ws');
, ws = require('../lib/ws/server');

var server = ws.createServer();

server.addListener("listening", function(){
sys.log("Listening for connections.");
});
var server = ws.createServer({debug: true});

// Handle WebSocket Requests
server.addListener("connection", function(conn){
Expand Down
14 changes: 10 additions & 4 deletions lib/ws/connection.js
@@ -1,12 +1,18 @@
/*-----------------------------------------------
Requirements:
-----------------------------------------------*/
var sys = require("sys")
var debug = function(){};

var util = require("../_util")
, events = require("events")
, Url = require("url")
, Events = require("events")
, Buffer = require("buffer").Buffer
, Crypto = require("crypto");

var _events = require("../_events")

var Mixin = require("../lang/mixin");

/*-----------------------------------------------
The Connection:
-----------------------------------------------*/
Expand All @@ -22,7 +28,7 @@ function Connection(server, req, socket, data){
debug = function (id, data) { };
}

Events.EventEmitter.call(this);
_events.EventEmitter.call(this);

this._req = req;
this._server = server;
Expand Down Expand Up @@ -172,7 +178,7 @@ function Connection(server, req, socket, data){
}
};

sys.inherits(Connection, Events.EventEmitter);
util.inherits(Connection, _events.EventEmitter);

/*-----------------------------------------------
Various utility style functions:
Expand Down

0 comments on commit 7ac5b74

Please sign in to comment.