gifsockets-server icon indicating copy to clipboard operation
gifsockets-server copied to clipboard

Break out gifsockets as middleware

Open twolfson opened this issue 12 years ago • 3 comments

It would be nice to use gifsockets on any server. This repo should be more of a demo than something to depend on.

First thought is function that returns an object of middlewares:

gifsocketsMiddleware({
  width: 20,
  height: 10
});
// Returns
{
  openImage: function (req, res) {},
  writeFrame: function (req, res) {}
}

It would make sense for writeTextToImage to be a middleware that comes before writeFrame, we just need to figure out how to do this sans raw-body parsing (probably make that a requisite for previous middlewares -- req.body || req.pixels)

twolfson avatar Nov 17 '13 10:11 twolfson

Technically, we can have another layer which is a class that has methods for adding streams (kind of like pipe), writing new frames, and closing streams.

twolfson avatar Nov 18 '13 02:11 twolfson

The addition of streams would return an id which allows us to close a specific stream or all of them.

twolfson avatar Nov 18 '13 02:11 twolfson

gifsockets has been broken out as a mediator. We should implement it and still consider doing a middleware

https://github.com/twolfson/gifsockets

twolfson avatar Nov 18 '13 12:11 twolfson