tugan
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
Giuseppe Corti
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.
tugan
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
tugan
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.preprocessor |SERVER POOLED THREAD 10 |Setting preprocessor of type COMMAND for item buddy_list
21-Oct-14 18:30:03,155|DEBUG|LightstreamerLogger.subscriptions|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.preprocessor |SERVER POOLED THREAD 8 |Setting preprocessor of type DISTINCT for item im_Guest575
21-Oct-14 18:30:03,257|DEBUG|LightstreamerLogger.preprocessor |SERVER POOLED THREAD 8 |No frequency prefilter for item im_Guest575
21-Oct-14 18:30:03,257|DEBUG|LightstreamerLogger.preprocessor |SERVER POOLED THREAD 8 |Snapshot buffer size for DISTINCT item im_Guest575 set to 30
21-Oct-14 18:30:03,257|DEBUG|LightstreamerLogger.subscriptions|SERVER POOLED THREAD 8 |Subscribing to item im_Guest575 on PROXY_NODECHAT.INVSTR_SIMPLE_MESSENGER
21-Oct-14 18:30:03,274|DEBUG|LightstreamerLogger.subscriptions|#2 Notify Receiver |INCOMING END OF SNAPSHOT NOTIFY for buddy_list
21-Oct-14 18:30:03,274|DEBUG|LightstreamerLogger.preprocessor |#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.subscriptions|#2 Notify Receiver |INCOMING END OF SNAPSHOT NOTIFY for im_Guest575
21-Oct-14 18:30:03,349|DEBUG|LightstreamerLogger.preprocessor |#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.subscriptions|#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.preprocessor |#2 Notify Receiver |Missing mandatory parameter in command event for key null
regards
tugan
Giuseppe Corti
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:
[SYNTAX=JSCRIPT]{command: "ADD", key: "Guest101"}[/SYNTAX]
In your case the JSON.stringify of buddyList results in string an finally in something of incomprehensible for the Lightstreamer server:
[SYNTAX=JSCRIPT]{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}[/SYNTAX]
You should simply use the object buddylist in the update method:
[SYNTAX=JSCRIPT]dataProvider.update(LIST, false, buddyList);[/SYNTAX]
HTH,
Giuseppe
tugan
thank you very much Giuseppe