Browse files

update serverstats example to show that write errors can be ignored

  • Loading branch information...
1 parent cda9ed7 commit c16ad34172c089d7affeae44784ab63edbe8499f @einaros einaros committed Jun 14, 2012
Showing with 3 additions and 2 deletions.
  1. +1 −1 examples/serverstats-express_3/server.js
  2. +2 −1 examples/serverstats/server.js
View
2 examples/serverstats-express_3/server.js
@@ -11,7 +11,7 @@ server.listen(8080);
var wss = new WebSocketServer({server: server});
wss.on('connection', function(ws) {
var id = setInterval(function() {
- ws.send(JSON.stringify(process.memoryUsage()));
+ ws.send(JSON.stringify(process.memoryUsage()), function() { /* ignore errors */ });
}, 100);
console.log('started client interval');
ws.on('close', function() {
View
3 examples/serverstats/server.js
@@ -3,12 +3,13 @@ var WebSocketServer = require('../../').Server
, express = require('express')
, app = express.createServer();
+app.use(express.static(__dirname + '/public'));
app.listen(8080);
var wss = new WebSocketServer({server: app});
wss.on('connection', function(ws) {
var id = setInterval(function() {
- ws.send(JSON.stringify(process.memoryUsage()));
+ ws.send(JSON.stringify(process.memoryUsage()), function() { /* ignore errors */ });
}, 100);
console.log('started client interval');
ws.on('close', function() {

0 comments on commit c16ad34

Please sign in to comment.