Re: cowboy: session state and connection timeout
"Lloyd R. Prentice" <[email protected]>
| Newsgroups | gmane.comp.lang.erlang.general |
|---|---|
| Message-ID | <[email protected]> |
Hi, A shameless plug for our book Build it with Nitrogen: https://builditwith.com/nitro It shows how to build Erlang-based sites with Cowboy and other servers, mnesia and other dbs, how to manage state, and much much more. Best of success with your project, LRP Sent from my iPad > On Mar 2, 2021, at 4:05 AM, Roger Lipscombe <[email protected]> wrote: > > On Tue, 2 Mar 2021 at 04:14, jdmeta <[email protected]> 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? > > Yes. > > 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 > inspiration.