Skip to content

Commit

Permalink
updated websocket server client code
Browse files Browse the repository at this point in the history
  • Loading branch information
benlemasurier committed Oct 14, 2011
1 parent 8da71c6 commit 83093de
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
29 changes: 14 additions & 15 deletions blode.js
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion example/js/blode_graph.js
Expand Up @@ -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
Expand Down

0 comments on commit 83093de

Please sign in to comment.