[erlang-questions] Implement parallel sessions

Frans Schneider <>
Tue Jan 27 12:50:18 CET 2015


Hi list,

I am implementing a kind of IM proxy which currently handles one single 
session for one user. The session is implemented as a stack of processes 
with from top to bottom the session control process, a stanza encoder / 
decoder process, an en- / decrypt process and finally a process which 
handles the tcp connection. Each process is a FSM and holds state such 
as RC4 encryption state, tcp data etc. The session is controlled by a 
supervisor which is part of a overall supervisor structure. A session 
will be open for a long period.

To implement for multiple users, I want to run the processes in the 
session stack for each user separately to keep them as simple as 
possible and isolate crashes, Each user session should be controlled by 
a supervisor.

What is a common approach to implementing a thing like this, i.e. a 
system with some interdependent processes in parallel?
I was thinking about using the via option for registering processes and 
passing the session id along when calling processes. Where does one keep 
the registry in such a scenario? Would some of the supervisors be a 
proper place?

Since I am still learning to do it the Erlang way, any hint is appreciated,

Frans



More information about the erlang-questions mailing list