[ejabberd] Pubsub with Ejabberd and exmpp

Shahzad shahbhat at gmail.com
Sun May 9 23:38:26 MSD 2010


Thank kael.



On May 7, 2010, at 1:42 PM, kael <ka-el at laposte.net> wrote:

> On 05/07/2010 07:14 PM, shahzad bhatti wrote:
>> One more thing, here is the IQ output that is being published:
>> Sending : {xmlel,'jabber:client',[],iq,
>>              [{xmlattr,undefined,type,<<"set">>},
>>               {xmlattr,undefined,to,<<"pubsub.myhost.local">>},
>>               {xmlattr,undefined,id,<<"pubsub-1337138231">>}],
>>              [{xmlel,'http://jabber.org/protocol/pubsub',[],pubsub, 
>> [],
>>                   [{xmlel,'http://jabber.org/protocol/pubsub',[],publish 
>> ,
>>                        [{xmlattr,undefined,node,<<"MSFT">>}],
>>                        [{xmlel,'http://jabber.org/protocol/pubsub',[],item 
>> ,
>>                             [],
>>                             [{xmlcdata,
>>                                  <<"{'symbol':'MSFT', 'bid':28.66,  
>> 'ask':28.67, 'bidSize':61, 'askSize':13, 'volume':65488100, 'last': 
>> 28.66}">>}]}]}]}]}
>> I am not sure if I am missing anything on the XML.
>
> In this sample, the payload (i.e. the child element of #xmlel{name =  
> 'item', ns = ?NS_PUBSUB}) is not an #xmlel{} but an #xmlcdata{}.
>
> Try with :
>
> ...
> Json = "{'symbol':'MSFT', 'bid':28.66, 'ask':28.67, 'bidSize':61,  
> 'askSize':13, 'volume':'65488100, 'last':28.66}",
>
> Quote = #xmlel{name = 'stocknews', children = [exmpp_xml:cdata 
> (Json)]},
>
> IQ = exmpp_client_pubsub:publish("pubsub."?XMPP_SERVER, Symbol,  
> Quote),
> ...
>
>
> As an aside, you might be interested by the deferred XEP-0067: Stock  
> Data Transmission <http://xmpp.org/extensions/xep-0067.html>.
>
> -- 
> kael
>
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd


More information about the ejabberd mailing list