# Xmpp4r and ejabberd

**URL:** <https://www.ruby-forum.com/t/xmpp4r-and-ejabberd/191618>\
**Category:** Ruby\
**Created:** [July 15, 2010, 12:20pm UTC](https://www.ruby-forum.com/t/xmpp4r-and-ejabberd/191618 "2010-07-15T12:20:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![siddharth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f19dbf/32.png) [@siddharth](https://www.ruby-forum.com/u/siddharth)\
**Post date:** [July 15, 2010, 12:20pm UTC](https://www.ruby-forum.com/t/xmpp4r-and-ejabberd/191618/1 "2010-07-15T12:20:46Z")

</div>

Im using xmpp4r and ejabberd and my server runs on EC2 on an elastic IP.

My problem is I am unable to connect to the server and my requests  
timeout.

On certain occasions the requests go through but the registrations dont  
reflect on the admin console. Most of the time i get a request timeout  
error.

My jabber server runs on a subdomain [jabber.example.com](http://jabber.example.com).

Snippet

> > client= Jabber::Client.new(Jabber::JID.new(“removed\_email\_address@domain.invalid”))  
> > … Successful connection …  
> > client.connect  
> > Errno::ETIMEDOUT: Connection timed out - connect(2)  
> > from  
> > /usr/lib/ruby/gems/1.8/gems/xmpp4r-0.5/lib/xmpp4r/connection.rb:66:in  
> > `initialize' from /usr/lib/ruby/gems/1.8/gems/xmpp4r-0.5/lib/xmpp4r/connection.rb:66:in `new’  
> > from  
> > /usr/lib/ruby/gems/1.8/gems/xmpp4r-0.5/lib/xmpp4r/connection.rb:66:in  
> > `connect' from /usr/lib/ruby/gems/1.8/gems/xmpp4r-0.5/lib/xmpp4r/client.rb:70:in `connect’  
> > from (irb):4

Im completely lost now I have tried reinstalling ejabberd but i keep  
having this issue. Am i missing something basic here?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![siddharth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f19dbf/32.png) [@siddharth](https://www.ruby-forum.com/u/siddharth)\
**Post date:** [July 15, 2010, 9:27pm UTC](https://www.ruby-forum.com/t/xmpp4r-and-ejabberd/191618/2 "2010-07-15T21:27:25Z")

</div>

Its actually an EC2 security groups issue. You need to ensure if the  
instance security groups has the port 5222 open. If your working with  
Server-2-Server then you should have 5269 open too.

The way to get that done on elastic fox is click on the security groups  
click on the group permissions, grant permission button (green tick  
button) and add the port. For host add 0.0.0.0/0 to allow all.

And thats it. Hope this is useful to someone. I can’t believe I missed  
this.
