Stage 10 final
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
-export([start/2, stop/1]).
|
||||
|
||||
start(_StartType, _StartArgs) ->
|
||||
pg:start_link(),
|
||||
application:ensure_all_started(mnesia),
|
||||
application:ensure_all_started(cowboy),
|
||||
|
||||
@@ -103,4 +104,22 @@ start_admin_http() ->
|
||||
middlewares => Middlewares
|
||||
}),
|
||||
|
||||
io:format("Admin HTTP server started on port ~p~n", [Port]).
|
||||
io:format("Admin HTTP server started on port ~p~n", [Port]),
|
||||
|
||||
% WebSocket для пользователей
|
||||
WsDispatch = cowboy_router:compile([
|
||||
{'_', [{"/ws", ws_handler, []}]}
|
||||
]),
|
||||
cowboy:start_clear(ws, [{port, 8081}], #{
|
||||
env => #{dispatch => WsDispatch}
|
||||
}),
|
||||
|
||||
% WebSocket для админов
|
||||
AdminWsDispatch = cowboy_router:compile([
|
||||
{'_', [{"/admin/ws", admin_ws_handler, []}]}
|
||||
]),
|
||||
cowboy:start_clear(admin_ws, [{port, 8446}], #{
|
||||
env => #{dispatch => AdminWsDispatch}
|
||||
}),
|
||||
|
||||
io:format("WebSocket started on ports 8081 (user) and 8446 (admin)~n").
|
||||
Reference in New Issue
Block a user