-
August 8th, 2013, 04:39 PM
#1
How to connect an application to Lightstreamer server
Hi,
I'm new at Lightstreamer server and I'm trying to connect my application in Java with Lightstreamer. I've tried this https://github.com/Weswit/Lightstrea...b-node-adapter and when I'm running node adapters.js it says that localhost(I replaced LIGHTSTREAMER_SERVER_HOST with localhost) is not found
That is this code:
- Get the net package and create the connections to Lightstreamer server. Note that the ports are the same used in the above file; LIGHTSTREAMER_SERVER_HOST is the host of the Lightstreamer server e.g.: "localhost".
var net = require('net'),reqRespStream = net.createConnection(8001, LIGHTSTREAMER_SERVER_HOST),notifyStream = net.createConnection(8002, LIGHTSTREAMER_SERVER_HOST),metadataStream = net.createConnection(8003, LIGHTSTREAMER_SERVER_HOST);
can anyone help me?
thanks
-
August 9th, 2013, 09:42 AM
#2
Hi Adriana,
First of all you should verify if the server is correctly configured, in particular see point 4 of section "Configure Lightstreamer", and if it is properly running: so, take a look at the log files in Lightstreamer/logs, and see if there are errors or warnings reported.
If server side everything seems working properly, but the Node Adapter still doesn't connect to the server, send us the exact error message you see.
HTH
Marco
-
August 9th, 2013, 01:01 PM
#3
Hi Marco,
I see the log file and there are no errors, the Lightstreamer is starting correctly.
This is the error message that the Node Adapter is giving to me when I call this command $ node adapters.js:
C:\Lightstreamer\adapters\NodeAdapter\lib\adapters .js:6
reqRespStream = net.createConnection(8001, localhost),
^
ReferenceError: localhost is not defined
at Object.<anonymous> (C:\Lightstreamer\adapters\NodeAdapter\lib\adapter s.js:6:44)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
-
August 9th, 2013, 02:02 PM
#4
Hi Adriana,
actually, if it's a literal string, you should write the address between quotes: so "localhost" instead of localhost, otherwise it is interpreted as a variable.
-
August 9th, 2013, 02:47 PM
#5
Thanks Marco, it passed but now it's giving me another error
module.js:340
throw err;
^
Error: Cannot find module 'lightstreamer-adapter'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (C:\Lightstreamer\adapters\NodeAdapter\lib\adapter s.js:11:24)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
what I suppose do to?
I've installed Node.js manually, not by running these command npm install lightstreamer-adapter, because it gives me the following error:
/cygdrive/c/Program Files/nodejs/npm: line 2: $'\r': command not found
/cygdrive/c/Program Files/nodejs/npm: line 4: $'\r': command not found
/cygdrive/c/Program Files/nodejs/npm: line 5: syntax error near unexpected token `$'in\r''
'cygdrive/c/Program Files/nodejs/npm: line 5: `case `uname` in
-
August 9th, 2013, 03:08 PM
#6
Hi Adriana,
if you have installed the windows version of node.js, try to run 'npm install lightstreamer-adapter' from a windows command instead of from a cygwin shell.
-
August 9th, 2013, 03:32 PM
#7
Hey Marco you were right, the installation passed that way, but running node adapters.js gives the same error... :/
Any idea what should I do?
Last edited by adriana; August 9th, 2013 at 04:26 PM.
-
August 9th, 2013, 04:31 PM
#8
if the error is still "Error: Cannot find module 'lightstreamer-adapter'", it means it is not able to properly install the adapter.
try to uninstall the adapter, clear the cache and reinstall it.
npm uninstall lightstreamer-adapter
npm cache clean
npm install lightstreamer-adapter
hth
-
August 9th, 2013, 05:01 PM
#9
Thanks Marco, it helps, but now I have another error
dataProvider.update(itemName, false, {
^
ReferenceError: itemName is not defined
at Object.<anonymous> (C:\Lightstreamer\sdk_adapter_node_1.0.0_build_3\l ib\node_modules\lightstreamer-adapter\lib\adapters.js:33:21)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
for what stands itemName, what is for?
tnx
-
August 9th, 2013, 05:34 PM
#10
As before itemName should be a literal string, so somethink like "MyItemName", or a variable: in this case you should have done before something like:
var itenName = "MyItemName"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 06:35 PM.
Bookmarks