macchiato-framework / macchiato-core

Ring style HTTP server abstraction for Node.js
MIT License
378 stars 35 forks source link

Make the session interface asynchronous. #3

Open niwinz opened 7 years ago

niwinz commented 7 years ago

The current implementation mimics the ring session middleware, that does not fits very well in nodejs environent. A great exampe can be, how I can implement a session store that uses redis. Many redis clients in node are asynchronous...

The session stores should be rethought and new, asynchronous interface should be defined in my opinion.

Ideas? Thoughts?

niwinz commented 7 years ago

I have done something similar to this on catacumba, that can be used as start point maybe: https://github.com/funcool/catacumba/blob/master/src/clojure/catacumba/handlers/session.clj

adamkl commented 3 years ago

I'd like to take a crack at this. I have a need to use redis as a session store, so I'd need an async interface.

@yogthos Any preferences on how I would extend the SessionStore protocol? Simply overload the existing methods to accept a callback? Then people can use promises/core.async as they see fit?

yogthos commented 3 years ago

Yeah that sounds reasonable to me, and thanks for taking a look.