- Documentation
- Reference manual
- Packages
- SWI-Prolog HTTP support
- The HTTP server libraries
- library(http/http_session): HTTP Session management
- http_set_session_options/1
- http_session_option/1
- http_set_session/1
- http_set_session/2
- http_session_id/1
- http_in_session/1
- http_open_session/2
- http_session_asserta/1
- http_session_assert/1
- http_session_retract/1
- http_session_retractall/1
- http_session_data/1
- http_session_asserta/2
- http_session_assert/2
- http_session_retract/2
- http_session_retractall/2
- http_session_data/2
- http_current_session/2
- http_close_session/1
- http_session_cookie/1
- hooked/0
- hook/1
- library(http/http_session): HTTP Session management
- The HTTP server libraries
- SWI-Prolog HTTP support
Availability:
:- use_module(library(http/http_session)).
http_session(end(SessionId, Peer))
The broadcast is done before the session data is destroyed and the listen-handlers are executed in context of the session that is being closed. Here is an example that destroys a Prolog thread that is associated to a thread:
:- listen(http_session(end(SessionId, _Peer)), kill_session_thread(SessionID)). kill_session_thread(SessionID) :- http_session_data(thread(ThreadID)), thread_signal(ThreadID, throw(session_closed)).
Succeed without any effect if SessionID does not refer to an active session.
If http_close_session/1
is called from a handler operating in the current session and the CGI
stream is still in state
header
, this predicate emits a Set-Cookie
to
expire the cookie.
- Errors
type_error(atom, SessionID)
- See also
- listen/2 for acting upon closed sessions