Results 1 to 6 of 6
  1. #1

    retriving "Field List" in Node.Js Adaptor

    Hi,

    I'm trying to implement Simple instant messenger adaptor in node.js

    client is starting subscription like the following

    var buddiesSubscription = new Subscription("COMMAND","buddy_list",["command", "key"]);
    or
    var imSubscription = new Subscription("DISTINCT","im_"+myNick,["fromNick", "toNick", "message"]);

    when I tried retrive filedName with getSchema, subscription events dont fire and subscription doesnt complete.

    what is your advice retriving field list in node adaptor?

    regards
    tugan

  2. #2
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    538
    Hi Tugan,

    It is not very clear to me the sequence of events in the issue.
    Please note that the 'getSchema' is called by the Lightstreamer server and the default implementation of the Lightstreamer SDK for Node Adapters simply split the group name by spaces. Please could you confirm if you have override this method?

    Please also note that the subscribe event is called only the first time for every Item.

  3. #3
    Hi Giuseppe


    I'm using totally OOTB just I'm trying replicate Basic instant messenger adaptor for node based on Node Adaptor for simple chat.


    client send what kind of object expectation but i dont know how will I retrieve in adaptor the object definition on node adaptor?


    I build up the required object manually but now I have issue for filed update such as


    if(buddyList){
    if (!(key in buddyList)) {
    buddyList["command"] = command;
    buddyList["key"] = key;
    }
    }
    else
    {
    buddyList["command"] = command;
    buddyList["key"] = key;
    }


    if(subscribedbuddylist) {
    dataProvider.update(LIST, false, JSON.stringify(buddyList));
    console.log("Buddy List :" + JSON.stringify(buddyList));


    looks like it is ok but client couldn't retrieve update.


    do you have some more detailed documentation?


    thanks in advance
    tugan

  4. #4
    I enabled log it looks like snapshot related do you have any advice

    21-Oct-14 18:30:03,154|DEBUG|LightstreamerLogger.requests |SERVER POOLED THREAD 9 |Requested item names: [buddy_list]
    21-Oct-14 18:30:03,154|DEBUG|LightstreamerLogger.requests |SERVER POOLED THREAD 9 |Requested field names: [command, key]
    21-Oct-14 18:30:03,154|DEBUG|LightstreamerLogger.requests |SERVER POOLED THREAD 9 |Max allowed frequency for user null and item buddy_list = 0.0
    21-Oct-14 18:30:03,155|DEBUG|LightstreamerLogger.requests |SERVER POOLED THREAD 9 |Setting min update distance for item buddy_list: requested = 0; allowed = 0; used = 0 ms
    21-Oct-14 18:30:03,155|DEBUG|LightstreamerLogger.requests |SERVER POOLED THREAD 9 |Max allowed buffer size for user null and item buddy_list = 0
    21-Oct-14 18:30:03,155|DEBUG|LightstreamerLogger.requests |SERVER POOLED THREAD 9 |Setting buffer size for item buddy_list: requested = 1; allowed = 0; used = 1
    21-Oct-14 18:30:03,155|DEBUG|LightstreamerLogger.preprocesso r |SERVER POOLED THREAD 10 |Setting preprocessor of type COMMAND for item buddy_list
    21-Oct-14 18:30:03,155|DEBUG|LightstreamerLogger.subscriptio ns|SERVER POOLED THREAD 10 |Subscribing to item buddy_list on PROXY_NODECHAT.INVSTR_SIMPLE_MESSENGER
    21-Oct-14 18:30:03,236|DEBUG|LightstreamerLogger.requests |SERVER POOLED THREAD 8 |Requested item names: [im_Guest575]
    21-Oct-14 18:30:03,236|DEBUG|LightstreamerLogger.requests |SERVER POOLED THREAD 8 |Requested field names: [fromNick, toNick, message]
    21-Oct-14 18:30:03,236|DEBUG|LightstreamerLogger.requests |SERVER POOLED THREAD 8 |Max allowed frequency for user null and item im_Guest575 = 0.0
    21-Oct-14 18:30:03,236|DEBUG|LightstreamerLogger.requests |SERVER POOLED THREAD 8 |Setting min update distance for item im_Guest575: requested = 0; allowed = 0; used = 0 ms
    21-Oct-14 18:30:03,236|DEBUG|LightstreamerLogger.requests |SERVER POOLED THREAD 8 |Max allowed buffer size for user null and item im_Guest575 = 0
    21-Oct-14 18:30:03,236|DEBUG|LightstreamerLogger.requests |SERVER POOLED THREAD 8 |Setting buffer size for item im_Guest575: requested = 0; allowed = 0; used = 0
    21-Oct-14 18:30:03,237|DEBUG|LightstreamerLogger.preprocesso r |SERVER POOLED THREAD 8 |Setting preprocessor of type DISTINCT for item im_Guest575
    21-Oct-14 18:30:03,257|DEBUG|LightstreamerLogger.preprocesso r |SERVER POOLED THREAD 8 |No frequency prefilter for item im_Guest575
    21-Oct-14 18:30:03,257|DEBUG|LightstreamerLogger.preprocesso r |SERVER POOLED THREAD 8 |Snapshot buffer size for DISTINCT item im_Guest575 set to 30
    21-Oct-14 18:30:03,257|DEBUG|LightstreamerLogger.subscriptio ns|SERVER POOLED THREAD 8 |Subscribing to item im_Guest575 on PROXY_NODECHAT.INVSTR_SIMPLE_MESSENGER
    21-Oct-14 18:30:03,274|DEBUG|LightstreamerLogger.subscriptio ns|#2 Notify Receiver |INCOMING END OF SNAPSHOT NOTIFY for buddy_list
    21-Oct-14 18:30:03,274|DEBUG|LightstreamerLogger.preprocesso r |#2 Notify Receiver |Dispatching COMMAND update for item buddy_list: Snapshot end signal for item buddy_list on PROXY_NODECHAT.INVSTR_SIMPLE_MESSENGER
    21-Oct-14 18:30:03,348|DEBUG|LightstreamerLogger.subscriptio ns|#2 Notify Receiver |INCOMING END OF SNAPSHOT NOTIFY for im_Guest575
    21-Oct-14 18:30:03,349|DEBUG|LightstreamerLogger.preprocesso r |#2 Notify Receiver |Dispatching DISTINCT update for item im_Guest575: Snapshot end signal for item im_Guest575 on PROXY_NODECHAT.INVSTR_SIMPLE_MESSENGER
    21-Oct-14 18:30:03,434|DEBUG|LightstreamerLogger.subscriptio ns|#2 Notify Receiver |INCOMING SNAPSHOT for buddy_list --> {19=e, 17=", 18=k, 33=}, 15=", 16=,, 13=D, 14=D, 11=", 12=A, 21=", 20=y, 22=:, 23=", 24=G, 25=u, 26=e, 27=s, 28=t, 29=5, 3=o, 2=c, 10=:, 1=", 0={, 30=7, 7=n, 6=a, 32=", 5=m, 31=5, 4=m, 9=", 8=d}
    21-Oct-14 18:30:03,434|WARN |LightstreamerLogger.preprocessor |#2 Notify Receiver |Unexpected snapshot event for COMMAND item buddy_list
    21-Oct-14 18:30:03,435|ERROR|LightstreamerLogger.preprocesso r |#2 Notify Receiver |Missing mandatory parameter in command event for key null

    regards
    tugan

  5. #5
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    538
    Hi Tugan,

    Please note that the "buddy_list" Item requested by the client is managed in command mode. This implies that the updates the Adapter send to the server must have some constraints; in particular must always contain fields "command" and "key".
    So the third parameter of the update method should be a JavaScript object with a structure like this:


    In your case the JSON.stringify of buddyList results in string an finally in something of incomprehensible for the Lightstreamer server:


    You should simply use the object buddylist in the update method:


    HTH,
    Giuseppe

  6. #6
    thank you very much Giuseppe

 

 

Similar Threads

  1. Help with Node.js "Hello World"
    By Jihua Zhou in forum Adapter APIs
    Replies: 6
    Last Post: December 30th, 2013, 09:00 AM
  2. Register with Command only to "ADD" and "REMOVE"
    By lidanh in forum Client APIs
    Replies: 4
    Last Post: August 6th, 2013, 05:27 PM
  3. "command" reserved data field
    By darch in forum Adapter APIs
    Replies: 4
    Last Post: April 2nd, 2013, 10:12 AM
  4. Replies: 3
    Last Post: February 18th, 2010, 11:14 PM
  5. Visual Basic Example of Data Adaptor
    By dianacastillo in forum Adapter APIs
    Replies: 1
    Last Post: April 15th, 2008, 11:52 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 04:04 PM.