Results 1 to 2 of 2

Thread: adapter.js test

  1. #1

    adapter.js test

    Testing the adapter.js example from the web but it prompts error of testitemName not subscribe, any advise?

    var net = require('net'),
    reqRespStream = net.createConnection(8001, 'localhost'),
    notifyStream = net.createConnection(8002, 'localhost'),
    metadataStream = net.createConnection(8003, 'localhost');


    var MetadataProvider = require('lightstreamer-adapter').MetadataProvider,
    DataProvider = require('lightstreamer-adapter').DataProvider,
    dataProvider = new DataProvider(reqRespStream, notifyStream),
    metadataProvider = new MetadataProvider(metadataStream);

    dataProvider.on('subscribe', function(itemName, response) {
    //HERE start sending updates for the itemName item
    console.log("Subcribed item: " + itemName);
    response.success();
    });

    dataProvider.on('unsubscribe', function(itemName, response) {
    //HERE stop sending updates for the itemName item
    console.log("Unsubscribed item: " + itemName);
    response.success();
    });

    metadataProvider.on('notifyUserMessage', function(request, response) {
    //HERE handle user message
    response.success();
    });


    dataProvider.update("testitemName", false, {
    'field1': "valField1",
    'field2': "valField2"
    });

    __________________________________________

    C:\Lightstreamer\adapters\NodeAdapter\node_modules \lightstreamer-adapter\lib\dataprovider.js:351
    throw new Error('Item [' + itemName + '] is not subscribed');
    ^
    Error: Item [testitemName] is not subscribed
    at getIdFromItemName (C:\Lightstreamer\adapters\NodeAdapter\node_module s\lightstreamer-adapter\lib\dataprovider.js:3
    51:10)
    at EventEmitter.update (C:\Lightstreamer\adapters\NodeAdapter\node_module s\lightstreamer-adapter\lib\dataprovider.js
    :300:21)
    at Object.<anonymous> (C:\Lightstreamer\adapters\NodeAdapter\adapters.js :30:14)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

  2. #2
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    Hi Loki,

    You are right the readme.md for the Node Adapters is a misleading.
    You can't actually send an update to an item until a client subscribed to such item.
    I suggest you to start from the hello world example located here: https://github.com/Weswit/Lightstrea...d-adapter-node

    In the meanwhile I will fix the readme.
    Sorry.

 

 

Similar Threads

  1. Stress Test / Performance
    By rmusco in forum General
    Replies: 5
    Last Post: January 4th, 2013, 01:38 AM
  2. MOBILE DEVICES: add your compatibility test here
    By Alessandro in forum Client APIs
    Replies: 7
    Last Post: May 8th, 2011, 11:26 AM
  3. MOBILE DEVICES: add your compatibility test here
    By Alessandro in forum Client APIs
    Replies: 2
    Last Post: October 6th, 2009, 10:57 PM
  4. Performance test for Lightstreamer
    By quanhm in forum General
    Replies: 1
    Last Post: May 19th, 2008, 10:48 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 10:17 PM.