Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7081395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:54:57+00:00 2026-05-28T06:54:57+00:00

I have an xmpp/ejabberdb app that uses an external service to provide eventing features,

  • 0

I have an xmpp/ejabberdb app that uses an external service to provide eventing features, but when this service becomes unavailable, I want to disconnect/logout all of my clients. Is this possible? How?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:54:58+00:00Added an answer on May 28, 2026 at 6:54 am

    I got it working the way I needed. In fact, I didn’t find any simple way to make my own server logout all connected users given some kind of situation, so I dug into ejabberd’s code and figured out a way to do it myself.

    In ejabberd_c2s.erl module, when a client logs out or it’s socket is dropped for some reason, the FSM is terminated, doing all necessary clean up to maintain ejabberd’s consistency.

    What I had to do was just create an exported function shutdown/1 in this module that calls gen_fsm:send_all_state_event/2 sending a signal for it to terminate.
    As for each connection there’s one c2s process, I need to call this function for each user.

    —UPDATING—
    Actually there’s no need to create this shutdown function, as ejabber_c2s already has the ability to process ‘closed’ signal, which does the same thing. So, instead of creating the shutdown function, simply doing ge_fsm:send_event(C2SPid, closed) might be enough.
    —UPDATING—

    To discover the user’s c2s process PID I just use ejabberd_sm:get_session_pid/1 or ejabberd_sm:dirty_get_sessions_list/0 (for all sessions).

    This worked fine for me, but if anyone has a better idea, please add here.

    Thanks

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have an XMPP application that uses MySQL to store information. We are not
I have an iPhone chat app using XMPP with an EJABBERD server that is
So I've created a simple XMPP app, but it appears I can't have background
I have a simple jabber bot in python.. this use xmpppy (import xmpp), this
I'm learning XMPP and I repeatedly see the word Roster but I have no
I am using XMPP with strope.js and openfire. I have a query that how
I have created a ban bot for an XMPP server, this is a part
I have implemented xmpp chat in ios app, connection get established, get authenticated, message
I have an activity that binds to a service. The service provides the functions
I have a service with usernames and passwords already set up that I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.