ostinelli / misultin

Misultin (pronounced mee-sool-téen) is an Erlang library for building fast lightweight HTTP(S) servers, which also supports websockets.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sessions for Websockets

egobrain opened this issue · comments

That's really good idea to create session server,
but can you create it for misultin_ws module, please ?

hi egobrain, why would you need that? websockets are (kinda) persistent by definition.

could you expand on your needs?

In my service i want accept connection only from authorized users.
Information about user authorization can be stored in session.
Am i right? Or there is a better way ?

Roberto Ostinelli
reply@reply.github.com
:

hi egobrain, why would you need that? websockets are persistent by
definition...


Reply to this email directly or view it on GitHub:

#80 (comment)

there are many different ways, all of which are outside the scope of this discussion :)

i get you are requesting to make sessions accessible to websockets, so i'll dig into that.

thank you,

r.

Thank you very much.
And i've got some more ideas :) i'll write about them later.

Roberto Ostinelli
reply@reply.github.com
:

there are many different ways, all of which are outside the scope of this
discussion :)

i get you are requesting to make sessions accessible to websockets, so
i'll dig into that.

thank you,

r.


Reply to this email directly or view it on GitHub:

#80 (comment)

hi egobrain,

i've been thinking about this.

sessions are a 'trick' to circumvent the fact that http is a stateless protocol. thus, most implementations (misultin's one too) generally use a cookie to save session ids, used then to retrieve data saved on the server.

websockets, on the contrary, are persistent connections, which can easily keep the state in the process which is handling them. moreover, cookies are generally out of the game.

therefore, even if conceptually these interactions are very different, a practical need i can try to understand from your request may be:

. save user authentication info (such as her name) during normal http authentication requests;
. when a websocket is used, allow it to retrieve this info too.

since websockets cannot normally create cookies, the requested functionality can only read existing sessions, and not create new ones.

implemented: dce39c9

please let me know if this works for you.

r.

Yes, that's it. Thank you!