Unable to connect to openfin runtime using openfin java adapter - openfin

I have been trying to connect to the openfin runtime using openfin java adapter. I am not specifying any port to connect to. I am also providing my own implementation of DesktopStateListener with the methods onReady, onClose, onError, onMessage, onOutgoingMessage. But when I call connect method for some reason the connection is not established and none of these methods are being called as well. It doesn't show any stacktrace about any possible exception as well. I am stuck in this scenario and not sure how to proceed further. Can someone tell me how I can figure this out.
I have been following the below openfin document
https://developer.openfin.co/docs/java/latest/
Any pointers would be much appreciated. Thanks in advance. Cheers!

Are you providing an instance of the RuntimeConfiguration object
as seen in the documentation here? To launch and connect to a runtime, I believe this needs to be passed into the connect method in order to resolve download and launch runtime to be connected to.

Related

How to create a server socket in Ethereum?

I need my Ethereum app to receive messages coming from outside through an SSL socket. I have no idea how realize it. Have you got any suggestion? I was thinking of creating a socket inside the app.js, but how? Can anyone help me, by giving me some code examples?
Thank you.
Ethereum smart contracts are not able to invoke off-chain services for security reasons.
So, creating a socket client inside your app is not possible.
In Ethereum world, Oracles are used to provide off-chain data to smart contracts.
Take a look at this documentation for some details.

Loopback required the Node Cluster module, which is incompatible with Passenger

I am trying to deploy my loopback service. But I am encountering a problem where i am unable to access it.
When trying to access I get the following error message:
Trace: You required the Node Cluster module, which is incompatible with Passenger, a non-functional shim was returned and your app may still work. However, please remove the related code as soon as possible.
Now I am not 100% sure this is the reason why I am unable to access it but it is not throwing any other messages.
I've already looked into the problem however I haven't found a solution. It seems that loopback uses something called shirtId which is a node module that uses a cluster function.
Removing this node module will result in my application not being able to start.
Has anyone else had this problem and maybe know of a fix?

Where to find what queries are hitting to gremlin server via gremlin-javascript

I am using gremlin-javascript module of nodejs to query titan database. Everything is working fine but I want to monitor what is actually hitting the gremlin server and anything else that i can get to know about that query. I already checked the gremlin-server log in logs folder inside the titan folder . I can not find anything of use in those logs. Any help in this regard will be extremely useful. thanks
For a client side solution with gremlin-javascript, there is currently no quick and easy way to log to the console outgoing queries or protocol messages sent to Gremlin Server.
You could either:
Implement your own function that wraps calls to the Gremlin client methods you call (typically client.execute()), and logs arguments. If using Node.js v6+, this could be a nice use case for an ES2015 Proxy object. This is the safest, non intrusive approach.
Monkeypatch the client.prototype.messageStream method, and log parameters. As of v2.3.2, this low level method gets called whether you're doing client.execute() or client.stream(). This is riskier and trickier.
Quick and dirty: edit the source code in ./node_modules/gremlin/lib/GremlinClient.js and add this after line 405 (prototype.messageStream definition):
console.log('query:', script);
console.log('params:', bindings);
There's currently an open issue about logging of ingoing messages but this could be developed to include outgoing messages as well (queries with parameters, down to protocol messages).

Web socket & Flash socket clients connect to one Node.js

I've got problem connecting Flash client to Node.js server.
Short story:
For a first time I'm building a Node.js server that should be used by both web client (WebSocket) as well as a Flash client (Socket). The web client, of course, works like a charm, but I can't get over the Flash one. I get SECURITY_ERROR. After a day of research I think it's because of the policy file not being loaded. Ideas (primus on top of engine.io) ?
Long story:
I'm using Primus as I thought I'll need it because I have both web sockets and flash sockets to handle. Not sure if this is accurate? :)
I'm using Engine.io as a 'transformer/transporter' - the main framework that the layer uses. I won't discuss the standard web client (using Chrome and primus-client), as it's easy to setup.
I'm using simple and standard Sockets in AS3:
_socket = new Socket();
_socket.addEventListener(Event.CONNECT, onSocketConnect);
//...
_socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
_socket.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
_socket.connect('localhost', '1337);
When building it within Flash IDE, it goes to the onSocketConnect function, but if I try to write anything to the socked - I get disconnected. If I run this from the web browser, I get into the onSecurityError method.
I must say that I don't get any traces in the node console!
primus.on('connection', function connection(spark) {
console.log('new connection'); // never gets logged!
As I know, security error is thrown when there is error with the policy file, so I started searching for a solution for that.
I've read a lot of things online, and most common solution was simple usage of socket.io and so called FlashSocket.IO. I tried implementing it, but it's so old, that some of the code is a kind of missing and I finally got some errors from the hurlant library - I couldn't get it working.
I also saw some node package called policy, which runs separate server to server the policy file.
I tried adding a transport array with flashsocket in it - no change. I also can't understand why all of the samples are using transports - I've searched and both index.js and primus.js are using transport (why there are two separate files, Jesus?!)
I could try using only engine.io without primus, but I don't know if this would be of any help. All the posts and samples I've found are pretty old - please help me with any up to date solution or at least some explanation what needs to be done - seems like a whole new universe to me :)
Thanks in advance!
Edit:
Thanks to the The_asMan, I figured out it has something to do with the handshake. I've tried this simple example (despite the fact it's so old) - it worked perfectly for the Flash client! Of course I cannot connect web sockets to it, as the handshake is not proper - it has some kind of protocol for it.
So I guess I just have to understand how to get the <policy-file-request/> in node - I'll be able to return the policy file. But I don't know how to get it - I don't receive any kind of data nor connect handler...
You have a cross domain policy issue.
I answered it all here.
AS3 - Flash/AIR Socket Communication writeUTFBytes only works once
just an idea:
On some operating systems, flush() is called automatically between execution frames, but on other operating systems, such as Windows, the data is never sent unless you call flush() explicitly. To ensure your application behaves reliably across all operating systems, it is a good practice to call the flush() method after writing each message (or related group of data) to the socket.

Xpages and OrientDB - how to handle connection object properly?

We would like to involve OrientDB (http://www.orientechnologies.com/) into the one of our Xpages projects. It suites well for our purposes using DocumentDatabase part of OrientDB.
Here we found a problem of how to deal with connection object. Instead of connecting and disconnecting manualy on every request we would like to use some shared connection for entire application. Documentation talks about it here https://github.com/orientechnologies/orientdb/wiki/Java-Web-Apps but its servlet filter, which is not suitable for Domino. Is there anyone having solution working properly with Domino and Xpages?
You need to write a custom datasource and within this datasource handle to connection pooling
look at this presentation
http://www.slideshare.net/NotesSensei/show107-the-datasource-session-take-xpages-data-boldly-where-no-xpages-data-has-been-taken-before
or check how it's done within the extension library sources. http://extlib.openntf.org/
a post about the connecting to jdbc using java
http://lazynotesguy.net/blog/2013/08/09/subclassing-an-extlib-component/
One thing you should be able to do is use an ApplicationListener in your App that will allow you to create the object on startup of the app and shut it down when the application is pulled out of memory.

Resources