Discussion:
Simple MUC Client
StuFF mc
2010-03-15 21:59:21 UTC
Permalink
Hi,

I've followed the example at
http://home.gna.org/xmpp4r/rdoc/classes/Jabber/MUC/SimpleMUCClient.html

but I've got the following error:

~/.gem/ruby/1.8/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:346:in
`send_data': undefined method `<<' for nil:NilClass (NoMethodError)
from /Users/stuffmc/.gem/ruby/1.8/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:344:in
`synchronize'
from /Users/stuffmc/.gem/ruby/1.8/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:344:in
`send_data'
from /Users/stuffmc/.gem/ruby/1.8/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:375:in
`send'
from /Users/stuffmc/.gem/ruby/1.8/gems/xmpp4r-0.5/lib/xmpp4r/muc/helper/mucclient.rb:91:in
`join'
from xmppd.rb:68:in `login'
from xmppd.rb:42:in `initialize'
from xmppd.rb:232:in `new'
from xmppd.rb:232


I'm really following the sample code aside for my room/server/nick
having names. I use the form "room-WQCBuIXaXYjQT0dZR+***@public.gmane.org/nick". What may I be
doing wrong?
Erik Elmore
2010-03-16 10:25:30 UTC
Permalink
It looks like you might not be connected to the server at the point where
the error is raised.

+=
Erik Elmore
Post by StuFF mc
Hi,
I've followed the example at
http://home.gna.org/xmpp4r/rdoc/classes/Jabber/MUC/SimpleMUCClient.html
~/.gem/ruby/1.8/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:346:in
`send_data': undefined method `<<' for nil:NilClass (NoMethodError)
from
/Users/stuffmc/.gem/ruby/1.8/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:344:in
`synchronize'
from
/Users/stuffmc/.gem/ruby/1.8/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:344:in
`send_data'
from
/Users/stuffmc/.gem/ruby/1.8/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:375:in
`send'
from
/Users/stuffmc/.gem/ruby/1.8/gems/xmpp4r-0.5/lib/xmpp4r/muc/helper/mucclient.rb:91:in
`join'
from xmppd.rb:68:in `login'
from xmppd.rb:42:in `initialize'
from xmppd.rb:232:in `new'
from xmppd.rb:232
I'm really following the sample code aside for my room/server/nick
doing wrong?
_______________________________________________
Xmpp4r-devel mailing list
https://mail.gna.org/listinfo/xmpp4r-devel
StuFF mc
2010-03-16 10:30:25 UTC
Permalink
Sorry guys forgot to mention I had fixed the problem. As you said, I
was trying to connect to the MUC without prior being connected
"normally". A bit stupid but the way MUC is handled in XMPP is somtime
a bit weird (like for example having the nick be a "resource" although
it's not a resource).

Anyways, XMPP4R rocks... I'm currently building a Drb speaking to my
rails app which communicates (via XMPP) to my iPhone app, and it's
pretty cool what you can achieve (in term of responsiveness, also in
Edge) using this technique.
Post by Erik Elmore
It looks like you might not be connected to the server at the point where
the error is raised.
+=
Erik Elmore
Post by StuFF mc
Hi,
I've followed the example at
http://home.gna.org/xmpp4r/rdoc/classes/Jabber/MUC/SimpleMUCClient.html
~/.gem/ruby/1.8/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:346:in
`send_data': undefined method `<<' for nil:NilClass (NoMethodError)
       from
/Users/stuffmc/.gem/ruby/1.8/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:344:in
`synchronize'
       from
/Users/stuffmc/.gem/ruby/1.8/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:344:in
`send_data'
       from
/Users/stuffmc/.gem/ruby/1.8/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:375:in
`send'
       from
/Users/stuffmc/.gem/ruby/1.8/gems/xmpp4r-0.5/lib/xmpp4r/muc/helper/mucclient.rb:91:in
`join'
       from xmppd.rb:68:in `login'
       from xmppd.rb:42:in `initialize'
       from xmppd.rb:232:in `new'
       from xmppd.rb:232
I'm really following the sample code aside for my room/server/nick
doing wrong?
_______________________________________________
Xmpp4r-devel mailing list
https://mail.gna.org/listinfo/xmpp4r-devel
_______________________________________________
Xmpp4r-devel mailing list
https://mail.gna.org/listinfo/xmpp4r-devel
Erik Elmore
2010-03-16 10:59:33 UTC
Permalink
If you consider how a MUC is modeled, the nick as a resource makes more
sense. The "room" itself is not much more than a repeater as it primarily
re-transmits messages it receives to all its members. A XMPP server may not
be the same software that actually runs the MUC, but the server will still
need to know how to route the message. To send a message in XMPP, the
recipient has to be defined by a valid JID--this means that in order to send
a message to this repeater service (the MUC) the room is going to need a
valid JID for itself. Since occupancy in the room is a quality only valid
within the context of the room itself, it makes sense for a member to be
addressable as a resource. An anonymous room would not necessarily disclose
the real JID's of its occupants, so the only way for one member to send a
private message to another member would be to send a message addressed to
the room's JID with the resource. Think of it like sending a letter with
C/O or ATTN on the envelope.

It might seem complicated or encumbered by protocol, but it makes things
easier to write logic for.

+=
Erik Elmore
Post by StuFF mc
Sorry guys forgot to mention I had fixed the problem. As you said, I
was trying to connect to the MUC without prior being connected
"normally". A bit stupid but the way MUC is handled in XMPP is somtime
a bit weird (like for example having the nick be a "resource" although
it's not a resource).
Anyways, XMPP4R rocks... I'm currently building a Drb speaking to my
rails app which communicates (via XMPP) to my iPhone app, and it's
pretty cool what you can achieve (in term of responsiveness, also in
Edge) using this technique.
Post by Erik Elmore
It looks like you might not be connected to the server at the point where
the error is raised.
+=
Erik Elmore
Post by StuFF mc
Hi,
I've followed the example at
http://home.gna.org/xmpp4r/rdoc/classes/Jabber/MUC/SimpleMUCClient.html
~/.gem/ruby/1.8/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:346:in
`send_data': undefined method `<<' for nil:NilClass (NoMethodError)
from
/Users/stuffmc/.gem/ruby/1.8/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:344:in
`synchronize'
from
/Users/stuffmc/.gem/ruby/1.8/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:344:in
`send_data'
from
/Users/stuffmc/.gem/ruby/1.8/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:375:in
`send'
from
/Users/stuffmc/.gem/ruby/1.8/gems/xmpp4r-0.5/lib/xmpp4r/muc/helper/mucclient.rb:91:in
Post by Erik Elmore
Post by StuFF mc
`join'
from xmppd.rb:68:in `login'
from xmppd.rb:42:in `initialize'
from xmppd.rb:232:in `new'
from xmppd.rb:232
I'm really following the sample code aside for my room/server/nick
doing wrong?
_______________________________________________
Xmpp4r-devel mailing list
https://mail.gna.org/listinfo/xmpp4r-devel
_______________________________________________
Xmpp4r-devel mailing list
https://mail.gna.org/listinfo/xmpp4r-devel
_______________________________________________
Xmpp4r-devel mailing list
https://mail.gna.org/listinfo/xmpp4r-devel
Loading...