We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm attempting to stream an audio feed using a server side GET route:
Meteor.Router.add('/audio/:id.ogg', 'GET', function(id) { if(channel) { this.response.writeHead(200, OGG_HTTP_HEADERS); encoder.stdout.pipe(this.response, {end: false}); } });
Where encoder's stdout is outputing a stream of ogg bytes.
Even if I do encoder.stdout.on('data', function(data){ response.write(data); });
While confirming every write occurs, I still only get 4096 bytes when I try to access the URL via GET:
http://127.0.0.1:3000/audio/45f1088b-1a43-437c-abd9-f990d876e63c.ogg Connecting to 127.0.0.1:3000... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [application/ogg] Saving to: `45f1088b-1a43-437c-abd9-f990d876e63c.ogg'
[ <=> ] 4,096 --.-K/s [ <=> ] 4,096 --.-K/s
ls -la 45f1088b-1a43-437c-abd9-f990d876e63c.ogg -rw-rw-r-- 1 jthomas jthomas 4096 Jul 10 23:01 45f1088b-1a43-437c-abd9-f990d876e63c.ogg
The text was updated successfully, but these errors were encountered:
Interesting. This is because we auto close the response I guess.
The challenge would be figuring out an API which is still simple for the standard use case, but allows you to do advanced stuff like this.
Sorry, something went wrong.
I just set a variable on response, and have the router code check if it exists, or if it is false, before doing anything to the response:
thedracle@6eacd7d
Not the most elegant solution, but it works-- and I can stream audio now :) Thanks for your tip.
No branches or pull requests
I'm attempting to stream an audio feed using a server side GET route:
Meteor.Router.add('/audio/:id.ogg', 'GET', function(id) {
if(channel) {
this.response.writeHead(200, OGG_HTTP_HEADERS);
encoder.stdout.pipe(this.response, {end: false});
}
});
Where encoder's stdout is outputing a stream of ogg bytes.
Even if I do
encoder.stdout.on('data', function(data){
response.write(data);
});
While confirming every write occurs, I still only get 4096 bytes when I try to access the URL via GET:
http://127.0.0.1:3000/audio/45f1088b-1a43-437c-abd9-f990d876e63c.ogg
Connecting to 127.0.0.1:3000... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/ogg]
Saving to: `45f1088b-1a43-437c-abd9-f990d876e63c.ogg'
ls -la 45f1088b-1a43-437c-abd9-f990d876e63c.ogg
-rw-rw-r-- 1 jthomas jthomas 4096 Jul 10 23:01 45f1088b-1a43-437c-abd9-f990d876e63c.ogg
The text was updated successfully, but these errors were encountered: