You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Response inherits from Stream instead of Stream.Readable (requiring request module browserify workaround) #81
This means the full stream API is not available as it is in Node, including the .resume() method. I believe this is the reason for this hack in the request module:
}elseif(response.resume){// response.resume should be defined, but check anyway before calling.// Workaround for browserify.response.resume()}
to improve compatibility would it be possible for http-browserify Response to inherit from Stream.Readable? (are there any other changes needed than changing the utils.inherits call?)
edit: Stream is old-style (pre-0.10); this amounts to converting http-browserify to Streams2
We (@goloroden and me) have written two small modules to stream JSON lines from a server to a client. Could be a very simple alternative to things like socket.io.
The client run’s great inside node and as we’re big fans of browserify we’d like to make it work inside the browser as well. But we're currently facing some compatibility problems that seem to be related to this issue.
When a client disconnects we’re using res.resume() to cleanup the response stream. However this fails when using browserify as Response currently doesn't inherit from Stream.Readable.
Do you have any plans to upgrade this module to the streams2 API? Maybe we can help to get this done. Any help or tips to get this issue resolved would be greatly appreciated.
P.S.: Thanks for creating this awesome browserify ecosystem!
For anybody having the same issues, @mattwagl and I have created a drop-in replacement for http-browserify that uses the streams2 API: http-browserify-2
Activity
Start changing Response to inherit from Stream.Readable
goloroden commentedon Apr 24, 2015
+1
mattwagl commentedon Apr 26, 2015
We (@goloroden and me) have written two small modules to stream JSON lines from a server to a client. Could be a very simple alternative to things like socket.io.
The client run’s great inside node and as we’re big fans of browserify we’d like to make it work inside the browser as well. But we're currently facing some compatibility problems that seem to be related to this issue.
When a client disconnects we’re using
res.resume()to cleanup the response stream. However this fails when using browserify asResponsecurrently doesn't inherit fromStream.Readable.Do you have any plans to upgrade this module to the streams2 API? Maybe we can help to get this done. Any help or tips to get this issue resolved would be greatly appreciated.
P.S.: Thanks for creating this awesome browserify ecosystem!
goloroden commentedon Apr 26, 2015
+1 :-)
goloroden commentedon May 26, 2015
For anybody having the same issues, @mattwagl and I have created a drop-in replacement for http-browserify that uses the streams2 API: http-browserify-2