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 6957039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:56:52+00:00 2026-05-27T14:56:52+00:00

I have a working Ejabberd server (version 2.1.9) and my client application running just

  • 0

I have a working Ejabberd server (version 2.1.9) and my client application running just fine, but I wish to modify the way the application’s XMPP client connects to Ejabberd in order to reduce the number of requests/responses between them, because its for a mobile environment and I wish to reduce the initial connection time.

I’ve looked up the XMPP protocol specification (RFC 6120) and some protocol extensions (XEPs), namely XEP-0305 Quickstart, but the protocol itself doesn’t specify single request sign in and the Quickstart extension although aims to reduce the number of requests isn’t enough for the time reduction I’m looking for.

After searching and not finding any solution I’ve started to modify both client and server and wish to accomplish the following for now as a proof of concept:

//Client Request
<?xml version='1.0'?>
<stream:stream ... user='user' pass='pass'>

//Server Response
<?xml version='1.0'?>
<stream:stream ... success='1'>

I’ve managed to modify my client accordingly and the Ejabberd server, and it seems they connect successfully, but any request the client makes after establishing the session doesn’t get a response by the server. I’ve used Wireshark to check the TCP connection client and server side: client side its open and the request is sent, and on the server side is also open and the request is received, but when I try to send the response it is not sent.

I’ve modified ONLY the file ejabberd_c2s.erl and the changes are the following:

//init function
...
%% changed the first state of the fsm to point to quickstart
%%          {ok, wait_for_stream, #state{socket = Socket1,
            {ok, wait_for_quickstart, #state{socket = Socket1,
...

//wait_for_quickstart function
...
case resource_conflict_action(U, StateData#state.server, R) of
  closenew ->
    send_header(StateData, Server, "1.0", DefaultLang, "0"),
    send_trailer(StateData),
    {stop, normal, StateData};
    {accept_resource, R2} ->
      JID = jlib:make_jid(U, StateData#state.server, R2),
      allow = acl:match_rule(Server,c2s,JID),   
      case ejabberd_auth:check_password(U, Server, P) of
        true ->
          send_header(StateData, Server, "1.0", DefaultLang, "1"),
          change_shaper(StateData, JID),
          {Fs, Ts} = ejabberd_hooks:run_fold(
            roster_get_subscription_lists,
            StateData#state.server,
            {[], []},
            [U, StateData#state.server]),
          LJID = jlib:jid_tolower(jlib:jid_remove_resource(JID)),
          Fs1 = [LJID | Fs],
          Ts1 = [LJID | Ts],
          PrivList =
            ejabberd_hooks:run_fold(
            privacy_get_user_list, 
            StateData#state.server,
            #userlist{},
           [U, StateData#state.server]),
         SID = {now(), self()},
         Conn = get_conn_type(StateData),
         Info = [{ip, StateData#state.ip},
         {conn, Conn},
         {auth_module, StateData#state.auth_module}],
         ejabberd_sm:open_session(SID, U, StateData#state.server, R, Info),
         NewStateData =
           StateData#state{
             user = U,
             resource = R2,
             jid = JID,
             sid = SID,
             conn = Conn,
             auth_module = ejabberd_auth_internal,
             authenticated = true,
             pres_f = ?SETS:from_list(Fs1),
             pres_t = ?SETS:from_list(Ts1),
             privacy_list = PrivList},
           fsm_next_state_pack(session_established,
           NewStateData);
        _ ->
          %%auth fail
          end
end.

Just to clarify: the initial client authentication request and server response are being transmitted just fine, subsequent requests are also being transmitted but there is no response to them.

I’m I overlooking something?

Thanks in advance

  • 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-27T14:56:53+00:00Added an answer on May 27, 2026 at 2:56 pm

    @Nuno-Freitas Indeed that was what was failing, thanks for your helpful insight.

    I added the code:

    R1 = xml:get_attr_s("r",Attrs),
    R = case jlib:resourceprep(R1) of
          error -> error;
          "" ->
            lists:concat([randoms:get_string() | tuple_to_list(now())]);
            Resource -> Resource
        end,
    

    That made the server respond to my requests, but there was other thing amiss: the <presence/> tag was breaking on server because the #state.lang was not defined, so I had to define it in the wait_for_quickstart function and now I have a single sign in XMPP client server working proof of concept.

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

Sidebar

Related Questions

I have working in jquery sortable, all are working fine. but empty div will
I have been working with relational databases for sometime, but it only recently occurred
I have working code: [self performSelector:@selector(doSomething) ]; but when I change this line to:
i have working codes from my server which is really working using Xampp server
I am making a DOM builder which I have working succesfully but now I
I have working fine my installation of Ruby on Rails on my Snow Leopard.
I have working copy of war file which is working fine in windows.. Now
I have everything working from the tutorial, replacing it with my data, but it
We have an application in Grails 2.0 that we have working when we run
I have working code but it seems a bit strange that I have to

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.