einaros/ws — Issue #24: Is it safe to use `wss._clients`?
Author: thomasfr
Created: 2012-02-12 14:01:34+00:00
State: open

```JavaScript

var WebSocketServer = require('ws').Server;
var util = require('util');

var httpServer = require('http').createServer(function (req, res) {
console.log("REQUEST", req);
res.end("END");
});
httpServer.listen(3000);

var wss = new WebSocketServer({server:httpServer});

httpServer.on('upgrade', function (req, socket, head) {
console.log('UPGRADE', req);
});

wss.on('connection', function (ws) {
console.log('clients# ', this._clients.length);
});

// Is it safe in the means of BC to use this?
wss._clients.forEach(function (ws) {
ws.send("foo");
});

```

Would be great to rename this variable to wss.clients maybe? To indicate that this varaible is safe to rely on?

Kind regards