Permalink
Browse files

flexibly support drain event

  • Loading branch information...
1 parent 5d43ead commit 2579237b54e530d72a3c50f02aa8ec44c81c4e54 @ericz ericz committed Jan 16, 2013
Showing with 6 additions and 8 deletions.
  1. +6 −8 lib/client.js
View
@@ -37,14 +37,12 @@ function BinaryClient(socket, options) {
self.emit('open');
});
// if node
- if(this._socket._sender) {
- this._socket._sender._socket.on('drain', function(){
- var ids = Object.keys(self.streams);
- for (var i = 0, ii = ids.length; i < ii; i++) {
- self.streams[ids[i]]._onDrain();
- }
- });
- }
+ this._socket.on('drain', function(){
+ var ids = Object.keys(self.streams);
+ for (var i = 0, ii = ids.length; i < ii; i++) {
+ self.streams[ids[i]]._onDrain();
+ }
+ });
// end node
this._socket.addEventListener('error', function(error){
var ids = Object.keys(self.streams);

0 comments on commit 2579237

Please sign in to comment.