update to work with ws instead of websocket-server#9
Open
neonstalwart wants to merge 2 commits intopersvr:masterfrom
Open
update to work with ws instead of websocket-server#9neonstalwart wants to merge 2 commits intopersvr:masterfrom
neonstalwart wants to merge 2 commits intopersvr:masterfrom
Conversation
Member
Author
|
I don't think streaming is working like it should. i want to try something tomorrow since ws sockets support streaming. |
it would be good if this could be made to stream from forEach but it seems that forEach doesn't accept backpressure.
Member
Author
|
@kriszyp is it possible to apply backpressure to using the following code when(jsgiApp(request), function(response){
when(response.body, function(body){
console.log('reading body...');
when(body.forEach(function (data) {
var dfd = require('./promise').defer();
console.log('sending data', data);
socket.send(data);
setTimeout(function () {
console.log('resolving', data);
dfd.resolve();
}, 300);
return dfd.promise;
}), function () {
console.log('done');
});
});
});i see this output reading body...
sending data {}&&
sending data [
sending data {"status":403,"headers":{"vary":"Accept","content-type":"message/json; charset=UTF-8"},"body":{}}
sending data ]
done
resolving {}&&
resolving [
resolving {"status":403,"headers":{"vary":"Accept","content-type":"message/json; charset=UTF-8"},"body":{}}
resolving ]i was hoping that i could return a promise from |
Member
Author
|
if there's no way to apply backpressure then this is probably as good as it gets so feel free to merge if you're ok with it. |
Member
|
Merged the commits, will take a look at back-pressure later. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.