Browse files

updated websocket server client code

  • Loading branch information...
1 parent 8da71c6 commit 83093de12bb63496f191ef8fce2b5e0927689607 @benlemasurier committed Oct 14, 2011
Showing with 15 additions and 16 deletions.
  1. +14 −15 blode.js
  2. +1 −1 example/js/blode_graph.js
View
29 blode.js
@@ -151,23 +151,22 @@ var http_broadcast = http.createServer(function(request, response) {
sys.puts("Event HTTP broadcast daemon started at " + HOST + ":" + config.broadcast_http_port);
// Websocket event broadcast
-ws_clients = [];
-ws.createServer(function(websocket) {
- var listener = null;
-
- websocket.addListener("connect", function() {
- var client = new Client(websocket);
- ws_clients.push(client);
-
- websocket.addListener("end", function() {
- ws_clients.remove(client);
- });
+var ws_clients = [];
+var ws_server = ws.createServer();
+ws_server.addListener("connection", function(connection) {
+ var listener = null,
+ client = new Client(connection);
+
+ ws_clients.push(client);
+ connection.addListener("end", function() {
+ ws_clients.remove(client);
+ });
- websocket.addListener("error", function(error) {
- ws_clients.remove(client);
- });
+ connection.addListener("error", function(error) {
+ ws_clients.remove(client);
});
-}).listen(8008);
+});
+ws_server.listen(8008);
sys.puts("Event web socket broadcast daemon started at " + HOST + ":" + config.websocket_port);
emitter.on("log", function(severity, message) {
View
2 example/js/blode_graph.js
@@ -6,7 +6,7 @@ var BlodeGraph = Class.create({
this._bar_padding = 1;
this._tick = 100; // 100ms
this._log_buffer = [];
- this._socket = new BlodeSocket().listen('10.10.10.2', '8008');
+ this._socket = new BlodeSocket().listen('127.0.0.1', '8008');
this.show_legend = false;
// color scheme

0 comments on commit 83093de

Please sign in to comment.