jgauffin / Griffin.Framework

Application framework for Business Applications
http://griffinframework.net
168 stars 62 forks source link

Streaming question #64

Closed A-KL closed 8 years ago

A-KL commented 8 years ago

I work on IoT project (Windows 10 IoT Core \ UWP) and trying to build MJpeg live video-streaming service.

After I went through your code it is still looks quite tricky to me. Basically I just need the way to get down to tcp connection on incoming request and together with response headers start sending mjpeg frames.

Here is an example of simple mjpeg streaming using Web.API which I'm trying to implement using your framework.

What is your opinion on this? Could you please point me where to start? Do I need to implement own listener or I can reuse HttpListener, but with a new encoder?

jgauffin commented 8 years ago

Do you want it over HTTP or another protocol?

A-KL commented 8 years ago

Yes, I want to send jpeg data (frames from web camera) over HTTP as multipart content. I discovered that it possible with your library but in opposite direction - receive data and save it directly to the physical file.

So I started with implementation of Serialize method at MultipartSerializer. However I still have no idea how to re-implement Response.Body to able to transfer endless sequence of data and not fixed size messages.

campersau commented 8 years ago

I think you need to implement your own HttpMessageEncoder which ignores the fixed size.

Here is a gzip implementation I wrote which automatically gzips the message and sends it in chunks to reduce memory usage on the server: https://gist.github.com/campersau/149a4569e57f3010f054399e7c3e0ec2 Maybe this helps you to implement your own.

A-KL commented 8 years ago

@campersau thank you! I'll have a look.

jgauffin commented 8 years ago

@campersau: Feel free to add a pull request

jgauffin commented 8 years ago

Did you get it to work?

A-KL commented 8 years ago

@jgauffin , yes I just created a prototype and it seems to work. In the couple of days I'll have a final version. Thank you guys!