Stage 10 final

This commit is contained in:
2026-04-22 23:15:20 +03:00
parent e3a08cfa04
commit 081dcf9588
85 changed files with 2116 additions and 160 deletions

View File

@@ -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").