Problem with exe and websocket at win11

I’m using: SWI-Prolog version 9.1.22

So I’m attempting to build a exe that can run a web server with websocket. I’m compiling with this line in the command promp:

swipl --stand_alone=true -o example -g main -c load.pl

this is an example of the files

load.pl

:-[
    websocket
].

main:- 
    server.

websocket.pl

:- use_module(library(http/thread_httpd)).
:- use_module(library(http/http_dispatch)).
:- use_module(library(http/http_json)).
:- use_module(library(http/http_parameters)).
:- use_module(library(http/websocket)).
:- use_module(library(http/http_error)).

% Star the server at port 9000
server :-
    http_server(http_dispatch, [port(9000)]).

% Stop the server at Port 9000
stop:-
    http_stop_server(9000, []).
        
% Paths
:- http_handler(root(time),
    http_upgrade_to_websocket(time_handler, []),
    [spawn([])]).


time_handler(WebSocket) :-
    ws_receive(WebSocket, Message, []),  % This waits until a message is received.
    (
        Message.opcode == "close"
    ->
        true
    ;
        time_response(Response_dict),
        ws_send(WebSocket, json(Response_dict)),
        time_handler(WebSocket)
    ).

time_response(Response_dict) :-
    get_time(Time),
    format_time(string(Message), '%c', Time),
    dict_create(Data, _, [message-Message]),
    dict_create(Response_dict, _, [data-Data,format-json,opcode-text]).

the exe ends its execution immediately after starting from powershell and I have not been able to maintain the web service.

http_server/2 doesn’t block, so the server/0 starts the server but then immediately finishes. For my servers, I put thread_get_message(_) as the last clause in my “main” predicate (so, server :- http_server(http_dispatch, [port(9000)]), thread_get_message(_).)