Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Various changes to the example and handling code in the Connection.

  • Loading branch information...
commit 7ac5b746895b672ac3196d0b49ce0f9a33da126d 1 parent 11f03ad
@miksago authored
Showing with 12 additions and 10 deletions.
  1. +2 −6 examples/echo-server.js
  2. +10 −4 lib/ws/connection.js
View
8 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){
View
14 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:
-----------------------------------------------*/
@@ -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;
@@ -172,7 +178,7 @@ function Connection(server, req, socket, data){
}
};
-sys.inherits(Connection, Events.EventEmitter);
+util.inherits(Connection, _events.EventEmitter);
/*-----------------------------------------------
Various utility style functions:
Please sign in to comment.
Something went wrong with that request. Please try again.