funbox/smppex

support starting MC in the client app supervision tree

sasa1977 opened this issue · 1 comments

Currently MC can be started via SMPPEX.MC.start, which starts the processes in the ranch app supervision tree. It would be nice if as a client developer I could start the MC somewhere in my own's app supervision tree. Luckily, ranch supports this via a so called embedded mode. The :ranch.child_spec/5 function can be used to generate a supervisor-compliant childspec.

My proposal is to add SMPPEX.MC.child_spec/1 which would take a keyword list of opts and delegate to :ranch.child_spec. That way the client developer could provide something like {SMPPEX.MC, session: {MySession, session_arg}, ...} as a supervisor child. This basically follows the Plug.Cowboy API.

If you agree, I'll be happy to submit a PR.

Hello!

Recently, I had to run a Cowboy webserver inside my own supervision tree, and I had to use ranch's embedded mod. After that a similar idea came to me too :)

So yes, it would be nice to implement this.