File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,9 @@ var ready = require('./ready');
88 <<< examples/write.js
99
1010**/
11+
12+ var nextTick = typeof setImmediate !== 'undefined' ? setImmediate : process . nextTick
13+
1114module . exports = function ( socket , opts ) {
1215 return function ( read ) {
1316 opts = opts || { }
@@ -22,7 +25,6 @@ module.exports = function(socket, opts) {
2225 socket . addEventListener ( 'close' , function ( ev ) {
2326 if ( ev . wasClean || ev . code === 1006 ) onClose ( )
2427 else {
25- console . log ( ev )
2628 var err = new Error ( 'ws error' )
2729 err . event = ev
2830 onClose ( err )
@@ -40,9 +42,8 @@ module.exports = function(socket, opts) {
4042 if ( end ) {
4143 return read ( end , function ( ) { } ) ;
4244 }
43-
4445 socket . send ( data ) ;
45- process . nextTick ( function ( ) {
46+ nextTick ( function ( ) {
4647 read ( null , next ) ;
4748 } ) ;
4849 } ) ;
@@ -51,6 +52,3 @@ module.exports = function(socket, opts) {
5152 read ( null , next ) ;
5253 }
5354}
54-
55-
56-
You can’t perform that action at this time.
0 commit comments