-module(jchat_sup). -behaviour(supervisor). -export([start_link/0, init/1]). start_link() -> supervisor:start_link({local, ?MODULE}, ?MODULE, []). init([]) -> % Initialize database jchat_db:init(), % Child specifications Children = [ % HTTP server #{ id => jchat_http, start => {jchat_http, start_link, []}, restart => permanent, shutdown => 5000, type => worker, modules => [jchat_http] }, % Push notification manager #{ id => jchat_push, start => {jchat_push, start_link, []}, restart => permanent, shutdown => 5000, type => worker, modules => [jchat_push] }, % Presence manager #{ id => jchat_presence, start => {jchat_presence, start_link, []}, restart => permanent, shutdown => 5000, type => worker, modules => [jchat_presence] } ], SupFlags = #{ strategy => one_for_one, intensity => 10, period => 60 }, {ok, {SupFlags, Children}}.