Pending connections list #3690
-
Is it possible to get a list of sessions for connections waiting to be resumed? I use the c2s_session_pending hook to catch the moment when ejabberd starts closing the c2s connection. I check all rooms for the current user and send a message about pending. But I only need the last user resource for each room. So, I need to understand what resources are already pending to be resumed. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I think I found solution with c2s_handle_call hook: c2s_handle_call(#{mod := Mod, mgmt_state := MgmtState} = State, {get_state}, From) -> Then I get list of user resources for each room in the c2s_session_pending handler and check status of each resource with PID = ejabberd_sm:get_session_pid(User, Server, Resource), |
Beta Was this translation helpful? Give feedback.
-
What's the use case here? |
Beta Was this translation helpful? Give feedback.
I think I found solution with c2s_handle_call hook:
c2s_handle_call(#{mod := Mod, mgmt_state := MgmtState} = State, {get_state}, From) ->
Mod:reply(From, MgmtState),
{stop, State};
c2s_handle_call(State, _Call, _From) ->
State.
Then I get list of user resources for each room in the c2s_session_pending handler and check status of each resource with
PID = ejabberd_sm:get_session_pid(User, Server, Resource),
case ejabberd_c2s:call(PID, {get_state}, timer:seconds(15)) of
active -> true;
_ -> false
end