<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">Hi,<div><br></div><div>A shameless plug for our book Build it with Nitrogen:</div><div><br></div><div><a href="https://builditwith.com/nitro">https://builditwith.com/nitro</a></div><div><br></div><div>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.</div><div><br></div><div>Best of success with your project,</div><div><br></div><div>LRP</div><div><br><div dir="ltr">Sent from my iPad</div><div dir="ltr"><br><blockquote type="cite">On Mar 2, 2021, at 4:05 AM, Roger Lipscombe <roger@differentpla.net> wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><span>On Tue, 2 Mar 2021 at 04:14, jdmeta <jdmeta@gmail.com> wrote:</span><br><span></span><br><blockquote type="cite"><span>it's still not completely clear to me how to maintain session state even for http in cowboy.</span><br></blockquote><blockquote type="cite"><span>this is a well-known function in most web serving frameworks.</span><br></blockquote><blockquote type="cite"><span>do i have to roll-my-own?</span><br></blockquote><span></span><br><span>Yes.</span><br><span></span><br><span>Cowboy isn't a web *framework*; it's a web *server*. There are several</span><br><span>web frameworks built on top of it. The most popular, if you're</span><br><span>prepared to use Elixir, is Phoenix: https://www.phoenixframework.org/.</span><br><span>For Erlang. I think that the one that's most actively maintained is</span><br><span>https://nitrogenproject.com/. There are others.</span><br><span></span><br><span>If you don't want to use one of those, and if you want session</span><br><span>support, you'll have to find a library that implements it, or</span><br><span>implement your own. There's some documentation about using cookies</span><br><span>with cowboy here:</span><br><span>https://ninenines.eu/docs/en/cowboy/2.5/guide/cookies/, but -- if you</span><br><span>want server-side sessions -- you'll need to combine that with a</span><br><span>session store, probably in ETS. Searching online for "cowboy session"</span><br><span>returns two Erlang libraries, both kinda old, but you can use them as</span><br><span>inspiration.</span><br></div></blockquote></div></body></html>