cowboy: session state and connection timeout
Tue Mar 2 10:04:55 CET 2021
On Tue, 2 Mar 2021 at 04:14, jdmeta <jdmeta@REDACTED> wrote:
> it's still not completely clear to me how to maintain session state even for http in cowboy.
> this is a well-known function in most web serving frameworks.
> do i have to roll-my-own?
Cowboy isn't a web *framework*; it's a web *server*. There are several
web frameworks built on top of it. The most popular, if you're
prepared to use Elixir, is Phoenix: https://www.phoenixframework.org/.
For Erlang. I think that the one that's most actively maintained is
https://nitrogenproject.com/. There are others.
If you don't want to use one of those, and if you want session
support, you'll have to find a library that implements it, or
implement your own. There's some documentation about using cookies
with cowboy here:
https://ninenines.eu/docs/en/cowboy/2.5/guide/cookies/, but -- if you
want server-side sessions -- you'll need to combine that with a
session store, probably in ETS. Searching online for "cowboy session"
returns two Erlang libraries, both kinda old, but you can use them as
More information about the erlang-questions