bloomberg / blpapi-node

Bloomberg Open API module for node.js
http://www.bloomberglabs.com/api/about/
Other
246 stars 50 forks source link

Does this actually work? #76

Open Rex90 opened 8 years ago

Rex90 commented 8 years ago

I am unable to open a connection on a machine with a logged in bberg terminal... No Errors.. nothing happens when i listen to connection open event

apaprocki commented 8 years ago

Yes, it actually works. Can you post your code to a gist?

Rex90 commented 8 years ago

Hi - literally just copy pasted the demo. I tried with localhost too

var blpapi = require('blpapi');
var session = new blpapi.Session({ host: '127.0.0.1', port: 8194 });

session.on('SessionStarted', function(m) {
    console.log("ready for work"); // never fires
});
Rex90 commented 8 years ago

I do see some warnings when im installing.. not sure they are relevant?

`

c:\other\commentary-sentiment\node_modules\blpapi>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js" configure build ) else (node "" configure build ) Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. blpapijs.cpp win_delay_load_hook.cc ..\blpapijs.cpp(176): warning C4267: 'argument': conversion from 'size_t' to 'uint32_t', possible loss of data [c: \other\commentary-sentiment\node_modules\blpapi\build\blpapijs.vcxproj] ..\blpapijs.cpp(621): warning C4003: not enough actual parameters for macro 'BLPAPI_EXCEPTION_IMPL' [c:\other\comm entary-sentiment\node_modules\blpapi\build\blpapijs.vcxproj] ..\blpapijs.cpp(719): warning C4003: not enough actual parameters for macro 'BLPAPI_EXCEPTION_IMPL' [c:\other\comm entary-sentiment\node_modules\blpapi\build\blpapijs.vcxproj] ..\blpapijs.cpp(785): warning C4003: not enough actual parameters for macro 'BLPAPI_EXCEPTION_IMPL' [c:\other\comm entary-sentiment\node_modules\blpapi\build\blpapijs.vcxproj] ..\blpapijs.cpp(828): warning C4003: not enough actual parameters for macro 'BLPAPI_EXCEPTION_IMPL' [c:\other\comm entary-sentiment\node_modules\blpapi\build\blpapijs.vcxproj] ..\blpapijs.cpp(940): warning C4003: not enough actual parameters for macro 'BLPAPI_EXCEPTION_IMPL' [c:\other\comm entary-sentiment\node_modules\blpapi\build\blpapijs.vcxproj] ..\blpapijs.cpp(961): warning C4267: 'argument': conversion from 'size_t' to 'uint32_t', possible loss of data [c: \other\commentary-sentiment\node_modules\blpapi\build\blpapijs.vcxproj] ..\blpapijs.cpp(989): warning C4267: 'argument': conversion from 'size_t' to 'uint32_t', possible loss of data [c: \other\commentary-sentiment\node_modules\blpapi\build\blpapijs.vcxproj] ..\blpapijs.cpp(1002): warning C4267: 'argument': conversion from 'size_t' to 'uint32_t', possible loss of data [c :\other\commentary-sentiment\node_modules\blpapi\build\blpapijs.vcxproj] ..\blpapijs.cpp(1057): warning C4267: 'argument': conversion from 'size_t' to 'uint32_t', possible loss of data [c :\other\commentary-sentiment\node_modules\blpapi\build\blpapijs.vcxproj] ..\blpapijs.cpp(1136): warning C4003: not enough actual parameters for macro 'BLPAPI_EXCEPTION_IMPL' [c:\other\com mentary-sentiment\node_modules\blpapi\build\blpapijs.vcxproj] ..\blpapijs.cpp(1249): warning C4003: not enough actual parameters for macro 'BLPAPI_EXCEPTION_IMPL' [c:\other\com mentary-sentiment\node_modules\blpapi\build\blpapijs.vcxproj] ..\blpapijs.cpp(1263): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data [c: \other\commentary-sentiment\node_modules\blpapi\build\blpapijs.vcxproj] ..\blpapijs.cpp(1281): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data [c:\oth er\commentary-sentiment\node_modules\blpapi\build\blpapijs.vcxproj] ..\blpapijs.cpp(1290): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data [c: \other\commentary-sentiment\node_modules\blpapi\build\blpapijs.vcxproj] ..\blpapijs.cpp(1402): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data [c:\oth er\commentary-sentiment\node_modules\blpapi\build\blpapijs.vcxproj] ..\blpapijs.cpp(1616): warning C4244: 'argument': conversion from '__int64' to 'const int', possible loss of data [c:\other\commentary-sentiment\node_modules\blpapi\build\blpapijs.vcxproj] ..\blpapijs.cpp(1630): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data [c:\oth er\commentary-sentiment\node_modules\blpapi\build\blpapijs.vcxproj] Creating library c:\other\commentary-sentiment\node_modules\blpapi\build\Release\blpapijs.lib and object c:\o ther\commentary-sentiment\node_modules\blpapi\build\Release\blpapijs.exp Generating code Finished generating code blpapijs.vcxproj -> c:\other\commentary-sentiment\node_modules\blpapi\build\Release\blpapijs.node blpapijs.vcxproj -> c:\other\commentary-sentiment\node_modules\blpapi\build\Release\blpapijs.pdb (Full PDB) blpapi@1.2.0 node_modules\blpapi └── custom-error-generator@7.0.0

`

acanessa commented 7 years ago

Hi. I'm having the same issue. Info bellow.

npm install blpapi

> blpapi@1.2.0 install /root/search/node_modules/blpapi
> node-gyp configure build

make: Entering directory '/root/search/node_modules/blpapi/build'
  CXX(target) Release/obj.target/blpapijs/blpapijs.o
../blpapijs.cpp: In static member function ‘static void BloombergLP::blpapijs::Session::New(const v8::FunctionCallbackInfo<v8::Value>&)’:
../blpapijs.cpp:559:37: warning: ‘v8::Local<v8::Int32> v8::Value::ToInt32() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
             serverPort = p->ToInt32()->Value();
                                     ^
In file included from ../blpapijs.cpp:5:0:
/root/.node-gyp/6.10.0/include/node/v8.h:8202:14: note: declared here
 Local<Int32> Value::ToInt32() const {
              ^
../blpapijs.cpp: In static member function ‘static v8::Handle<v8::Value> BloombergLP::blpapijs::Session::elementToValue(v8::Isolate*, const BloombergLP::blpapi::Element&)’:
../blpapijs.cpp:1282:67: warning: ‘bool v8::Object::ForceSet(v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)’ is deprecated: Use CreateDataProperty / DefineOwnProperty [-Wdeprecated-declarations]
                    sev, (PropertyAttribute)(ReadOnly | DontDelete));
                                                                   ^
In file included from /root/.node-gyp/6.10.0/include/node/v8.h:25:0,
                 from ../blpapijs.cpp:5:
/root/.node-gyp/6.10.0/include/node/v8.h:2695:22: note: declared here
                 bool ForceSet(Local<Value> key, Local<Value> value,
                      ^
/root/.node-gyp/6.10.0/include/node/v8config.h:333:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^
../blpapijs.cpp: In member function ‘void BloombergLP::blpapijs::Session::processMessage(v8::Isolate*, BloombergLP::blpapi::Event::EventType, const BloombergLP::blpapi::Message&)’:
../blpapijs.cpp:1639:59: warning: ‘bool v8::Object::ForceSet(v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)’ is deprecated: Use CreateDataProperty / DefineOwnProperty [-Wdeprecated-declarations]
                 (PropertyAttribute)(ReadOnly | DontDelete));
                                                           ^
In file included from /root/.node-gyp/6.10.0/include/node/v8.h:25:0,
                 from ../blpapijs.cpp:5:
/root/.node-gyp/6.10.0/include/node/v8.h:2695:22: note: declared here
                 bool ForceSet(Local<Value> key, Local<Value> value,
                      ^
/root/.node-gyp/6.10.0/include/node/v8config.h:333:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^
../blpapijs.cpp:1642:59: warning: ‘bool v8::Object::ForceSet(v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)’ is deprecated: Use CreateDataProperty / DefineOwnProperty [-Wdeprecated-declarations]
                 (PropertyAttribute)(ReadOnly | DontDelete));
                                                           ^
In file included from /root/.node-gyp/6.10.0/include/node/v8.h:25:0,
                 from ../blpapijs.cpp:5:
/root/.node-gyp/6.10.0/include/node/v8.h:2695:22: note: declared here
                 bool ForceSet(Local<Value> key, Local<Value> value,
                      ^
/root/.node-gyp/6.10.0/include/node/v8config.h:333:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^
../blpapijs.cpp:1645:59: warning: ‘bool v8::Object::ForceSet(v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)’ is deprecated: Use CreateDataProperty / DefineOwnProperty [-Wdeprecated-declarations]
                 (PropertyAttribute)(ReadOnly | DontDelete));
                                                           ^
In file included from /root/.node-gyp/6.10.0/include/node/v8.h:25:0,
                 from ../blpapijs.cpp:5:
/root/.node-gyp/6.10.0/include/node/v8.h:2695:22: note: declared here
                 bool ForceSet(Local<Value> key, Local<Value> value,
                      ^
/root/.node-gyp/6.10.0/include/node/v8config.h:333:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^
../blpapijs.cpp:1691:73: warning: ‘bool v8::Object::ForceSet(v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)’ is deprecated: Use CreateDataProperty / DefineOwnProperty [-Wdeprecated-declarations]
                 correlations, (PropertyAttribute)(ReadOnly | DontDelete));
                                                                         ^
In file included from /root/.node-gyp/6.10.0/include/node/v8.h:25:0,
                 from ../blpapijs.cpp:5:
/root/.node-gyp/6.10.0/include/node/v8.h:2695:22: note: declared here
                 bool ForceSet(Local<Value> key, Local<Value> value,
                      ^
/root/.node-gyp/6.10.0/include/node/v8config.h:333:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^
../blpapijs.cpp:1693:58: warning: ‘bool v8::Object::ForceSet(v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)’ is deprecated: Use CreateDataProperty / DefineOwnProperty [-Wdeprecated-declarations]
     o->ForceSet(Local<String>::New(isolate, s_data), data);
                                                          ^
In file included from /root/.node-gyp/6.10.0/include/node/v8.h:25:0,
                 from ../blpapijs.cpp:5:
/root/.node-gyp/6.10.0/include/node/v8.h:2695:22: note: declared here
                 bool ForceSet(Local<Value> key, Local<Value> value,
                      ^
/root/.node-gyp/6.10.0/include/node/v8config.h:333:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^
../blpapijs.cpp:1696:76: warning: ‘bool v8::Object::ForceSet(v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)’ is deprecated: Use CreateDataProperty / DefineOwnProperty [-Wdeprecated-declarations]
         data->ForceSet(Local<String>::New(isolate, s_identity), identityObj);
                                                                            ^
In file included from /root/.node-gyp/6.10.0/include/node/v8.h:25:0,
                 from ../blpapijs.cpp:5:
/root/.node-gyp/6.10.0/include/node/v8.h:2695:22: note: declared here
                 bool ForceSet(Local<Value> key, Local<Value> value,
                      ^
/root/.node-gyp/6.10.0/include/node/v8config.h:333:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^
  SOLINK_MODULE(target) Release/obj.target/blpapijs.node
  COPY Release/blpapijs.node
make: Leaving directory '/root/search/node_modules/blpapi/build'
backend@1.0.0 /root/search
└── blpapi@1.2.0

npm WARN backend@1.0.0 No repository field.
npm WARN backend@1.0.0 No license field.

My code:

var blpapi = require('blpapi');
var session = new blpapi.Session({ host: '127.0.0.1', port: 8194 });

session.on('SessionStarted', function(m) {
    console.log("ready for work"); // never fires
});

I run the code and no errors, but SessionStarted does not work. What am I doing wrong?

scottkunkel commented 7 years ago

Did you call session.start() in the end?