florimondmanca / awesome-asgi

A curated list of awesome ASGI servers, frameworks, apps, libraries, and other resources
Creative Commons Zero v1.0 Universal
1.58k stars 98 forks source link

Add ASGI-Sessions #59

Open klen opened 3 years ago

klen commented 3 years ago

Add ASGI-Sessions

Checklist

What is this project?

ASGI-Sessions - Signed Cookie-Based HTTP sessions for ASGI applications (supports asyncio/trio libs)

Do you know about other similar projects?

yes

If so, how is this one different?

It supports not only asyncio, but trio library as well


Anyone who agrees with this pull request can add a 👍.

florimondmanca commented 3 years ago

Hello! Thanks, this is interesting.

How does this compare with Starlette's SessionMiddleware? Are there missing features you've been wanting there?

I understand that you are developing asgi-tools, would you have some more background on the motivation behind that?

(Just trying to understand motivations. I believe initially Starlette was aimed at becoming a foundational, no-dependencies, ASGI-centric framework, so always curious about new tacks with that role. :-) If it's mostly out of personal curiosity or learning I can totally understand — that's where I came from as well. Just obviously a bit reluctant to include things in this list that might end up being close-duplicates and not necessarily serving the ecosystem as a whole.)

Thanks!

klen commented 3 years ago

Obviously Starlette's SessionMiddleware depends on Starlette itself. ASGI-Sessions based on ASGI-Tools which one much smaller (ASGI-Tools not going to include support template engine, graphql, databases, authentication and etc support).

The most important thing in my opinion ASGI-Tools supports Trio too (natively) (Startlette is not for the current moment).

Besides that, the ASGI-Sessions uses PyJWT and only writes cookies when a user session has been changed. Starlette's SessionMiddleware writes the cookie for every request.

That's it for the ASGI-Sessions for ASGI-Tools I can say much more, but it's an offtopic

euri10 commented 2 years ago

interesting as well !