Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jabber client authentication hangs #32

Open
akshaysmurthy opened this issue May 9, 2013 · 0 comments
Open

Jabber client authentication hangs #32

akshaysmurthy opened this issue May 9, 2013 · 0 comments

Comments

@akshaysmurthy
Copy link

I have the following method in a class called Chat. As the name suggests, the method intends to create a chat room for a set of usernames passed, along with configurations for the room. But the statement "chat_client.auth" gets stuck at times. I am saying this because the last log I see is "**Authorizing client". Is there something that I am not doing right?

def self.create_room_for(options)
        Rails.logger.info "\n**Creating room for #{options}\n"  
        chat_room_name = "#{options[:chat_usernames].join('_')}@conference.#{CHAT_SERVER_DOMAIN}/localclient"
        begin
            chat_username = options[:chat_usernames].first
            Rails.logger.info "Creating JID"
            chat_client = Jabber::Client.new(Jabber::JID::new("#{chat_username}@#{CHAT_SERVER_DOMAIN}"))
            Rails.logger.info "Connecting to Chat server"
            chat_client.allow_tls = false
            chat_client.connect
            Rails.logger.info "\n**Authorizing client\n" #Nothing gets logged beyond this
            chat_client.auth("some_password")
            muc = Jabber::MUC::MUCClient.new(chat_client)
            Rails.logger.info "\n**Joining room\n"
            muc.join(Jabber::JID::new(chat_room_name))
            muc.configure("muc#roomconfig_persistentroom" => 1, "muc#roomconfig_enablelogging" => 1, "muc#roomconfig_publicroom" => options[:public_room]) if muc.owner?
        rescue Exception => e
            Airbrake.notify(e)
        ensure
            muc.exit
            chat_client.close
        end  
    end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant