XMPP noob issue

16 views
Skip to first unread message

Chris Maguire

unread,
Feb 22, 2010, 10:51:19 AM2/22/10
to collecta developer
Hi folks,

I'm working on a Collecta XMPP ap in PHP ( something I haven't seen
any example code for yet, so when I get it running I plan on writing a
tutorial ) and I'm running into some elementary issues.

Since there does not seem to be an adequate PHP library for pubsub,
I'm working from the base level and opening socket connections myself.
I'm connecting to Collecta fine at this point, but every time I try to
subscribe to a search query using the examples provided by Collecta I
get an "invalid-namespace" error.

The data I'm sending is as follows:

<iq type='set' from='sea...@postling.com' to='search.collecta.com'
id='sdfsafsd'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<subscribe jid='sea...@postling.com' node='search'/>
<options>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE' type='hidden'>
<value>http://jabber.org/protocol/pubsub#subscribe_options</value>
</field>
<field var='x-collecta#apikey'>
<value>".COLLECTA_API_KEY."</value>
</field>
<field var='x-collecta#query'>
<value>earthquake</value>
</field>
</x>
</options>
</pubsub>
</iq>


And the response I get is:


<?xml version='1.0'?><stream:stream xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams' id='2007589065'
from='collecta.com' xml:lang='en'><stream:error><invalid-namespace
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/></stream:error></
stream:stream>

I suspect I'm either missing a required XML prefix of some kind or
I've got the ID / JID stuff all wrong ( or both ), but I figure you
folks will be able to point me in the right direction.

Christopher Zorn

unread,
Feb 22, 2010, 11:16:41 AM2/22/10
to collecta-...@googlegroups.com
On Mon, Feb 22, 2010 at 10:51 AM, Chris Maguire <chris....@gmail.com> wrote:
Hi folks,

Hello Chris. I have a few questions below.
 

The error is a bit odd, but it seems like you are attempting a direct connection to our server. Is this correct?

The iq above has the JIDs as postling.com.  Does postling have an XMPP server? Are you trying to use it to connect to Collecta? Or do you want a to use a direct connection to collecta.com?



Chris Maguire

unread,
Feb 22, 2010, 11:39:38 AM2/22/10
to collecta developer
Hi Chris, thanks for replying!

Those are excellent questions, as I'm still trying to figure out what
would be best in this scenario.

What I'm trying to do is something like the following:

1. Users on Postling.com set up saved search queries ( generally to
monitor discussion about their businesses, looking something like
"Joe's Pizza Place" )
2. Postling maintains a connection to Collecta, monitoring the stream
as it comes in and caches the results in our database
3. Users can then view the results to their saved searches streaming
in on Postling, and have a historical record of results since they set
up the query

I *think* what would be best would be to set up an XMPP server on
Postling's side to connect to Collecta and manage all of the
connections / queries directly between the two sites. This server is
not yet written, and this is the beginning of my explorations into
creating one.

In essence, I want to build a system that subscribes to multiple
search queries through Collecta and caches all of the results as they
come in. What method do you think would be best to accomplish such a
thing?


On Feb 22, 11:16 am, Christopher Zorn <christopher.z...@gmail.com>
wrote:


> On Mon, Feb 22, 2010 at 10:51 AM, Chris Maguire <chris.magu...@gmail.com>wrote:
>
>
>
>
>
> > Hi folks,
>
> > Hello Chris. I have a few questions below.
> > I'm working on a Collecta XMPP ap in PHP ( something I haven't seen
> > any example code for yet, so when I get it running I plan on writing a
> > tutorial ) and I'm running into some elementary issues.
>
> > Since there does not seem to be an adequate PHP library for pubsub,
> > I'm working from the base level and opening socket connections myself.
> > I'm connecting to Collecta fine at this point, but every time I try to
> > subscribe to a search query using the examples provided by Collecta I
> > get an "invalid-namespace" error.
>
> > The data I'm sending is as follows:
>

> > <iq type='set' from='sear...@postling.com' to='search.collecta.com'


> > id='sdfsafsd'>
> > <pubsub xmlns='http://jabber.org/protocol/pubsub'>

> > <subscribe jid='sear...@postling.com' node='search'/>

Christopher Zorn

unread,
Feb 22, 2010, 7:53:51 PM2/22/10
to collecta-...@googlegroups.com
On Mon, Feb 22, 2010 at 11:39 AM, Chris Maguire <chris....@gmail.com> wrote:
Hi Chris, thanks for replying!

Those are excellent questions, as I'm still trying to figure out what
would be best in this scenario.

What I'm trying to do is something like the following:

1. Users on Postling.com set up saved search queries ( generally to
monitor discussion about their businesses, looking something like
"Joe's Pizza Place" )
2. Postling maintains a connection to Collecta, monitoring the stream
as it comes in and caches the results in our database
3. Users can then view the results to their saved searches streaming
in on Postling, and have a historical record of results since they set
up the query

I *think* what would be best would be to set up an XMPP server on
Postling's side to connect to Collecta and manage all of the
connections / queries directly between the two sites. This server is
not yet written, and this is the beginning of my explorations into
creating one.

In essence, I want to build a system that subscribes to multiple
search queries through Collecta and caches all of the results as they
come in. What method do you think would be best to accomplish such a
thing?


This sounds like a perfectly fine start. You are planning on writing the server to server (s2s) part in PHP?
Running a free XMPP server and then writing a module for it may be easier. Prosody (http://prosody.im/) is a good one and quick to write modules.

There is also a python implementation of s2s in a library called wokkel. http://wokkel.ik.nu/

Here is a ping example that you can modify to do pubsub requests to Collecta.

http://wokkel.ik.nu/browser/doc/examples/pinger_s2s.tac
http://wokkel.ik.nu/browser/doc/examples/pinger.py


 

Chris Maguire

unread,
Feb 23, 2010, 3:19:10 PM2/23/10
to collecta developer
Thanks for the suggestions, we're installing Prosody now and we'll see
how it goes.

I'll almost certainly write back again when we get stuck later on ;D

-chris

On Feb 22, 7:53 pm, Christopher Zorn <christopher.z...@gmail.com>
wrote:

> There is also a python implementation of s2s in a library called wokkel.http://wokkel.ik.nu/


>
> Here is a ping example that you can modify to do pubsub requests to
> Collecta.
>

> http://wokkel.ik.nu/browser/doc/examples/pinger_s2s.tachttp://wokkel.ik.nu/browser/doc/examples/pinger.py

> > > > xmlns:stream='http://etherx.jabber.org/streams'id='2007589065<http://etherx.jabber.org/streams%27id=%272007589065>

Reply all
Reply to author
Forward
0 new messages