objective c - iOS XMPP PubSub not receiving events while publishing node to my subscribed users -


i using xmppclient ejjaberd chat application(like whatsapp). want implement xmpppubsub notify users when 1 of user changed his/her profile picture.

my framework : https://github.com/robbiehanson/xmppframework

here code

initialize xmpppubsub

xmppjid *servicejid =[xmppjid jidwithstring:[nsstring stringwithformat:@"pubsub.%@",[[sharedclass sharedinstance] hostname]]];      _xmpppubsub = [[xmpppubsub alloc]initwithservicejid:servicejid     dispatchqueue:dispatch_get_main_queue()];     [_xmpppubsub adddelegate:self delegatequeue:dispatch_get_main_queue()];     [_xmpppubsub activate:xmppstream]; 

to create node :

nsstring *nodename =[[nsuserdefaults standarduserdefaults] valueforkey:@"kmobileno"]; // logged in user or current user [[[xmppclient sharedinstance] xmpppubsub] createnode:nodename withoptions:@{@"pubsub#title":nodename,@"pubsub#deliver_notifications":@"1",@"pubsub#subscribe":@"1",@"pubsub#presence_based_delivery":@"1",@"pubsub#publish_model":@"open",@"pubsub#access_model":@"open",@"pubsub#persist_items":@"1",@"pubsub#notify_sub":@"1",@"pubsub#deliver_payloads":@"1"}]; 

to subscribe users

for (contact *obj in arrayusers) {         nslog(@"elsa user %@",obj.phonenumber);         [[xmppclient sharedinstance].xmpppubsub subscribetonode:obj.phonenumber withjid:[xmppclient sharedinstance].xmppstream.myjid options: @{ @"pubsub#deliver"      : @(yes),                                                                                                                                                  @"pubsub#digest"       : @(yes),                                                                                                                                                  @"pubsub#include_body" : @(yes),                                                                                                                                              @"pubsub#show-values"  : @[ @"chat", @"online", @"away" ] }];   } 

to publish events :

    nsstring *nodename =[[nsuserdefaults standarduserdefaults] valueforkey:@"kmobileno"];      nsxmlelement *body = [nsxmlelement elementwithname:@"body"];             [body setstringvalue:@"string post"];     nsxmlelement *messagebody = [nsxmlelement elementwithname:@"message"];    [messagebody setxmlns:@"jabber:client"];    [messagebody addchild:body];    [[[xmppclient sharedinstance] xmpppubsub] publishtonode:nodename entry:messagebody withitemid:nil options:@{@"pubsub#access_model":@"open"}]; 

my problems are

  1. i not receiving events on below delegate , when user publish node subscribed users

    -(void)xmpppubsub:(xmpppubsub *)sender didreceivemessage:(xmppmessage *)message { nslog(@"message %@",message); }

but getting events correctly on above delegate when create node. creating node after initialise pubsub. getting events when launch app because initializing pubsub on appdelegate.

also receiving same events continously whenever launch app. example , if have event(profile pic changed) received on "didreceivemessage" on launch of application. same on next every launches.

i want events on "didreceivemessage" delegate when publish subscribed users(when user change profile picture) , not when launch app(when create node).

  1. how users subscribed me. ?

3.how know node created number ?

4.i want know why getting events when creating node instead of when user publish node ?

5.why receiving same events again , again whenever create node ? please me . in advance.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -