I am new to RabbitMQ. I work with PhantomJS and use JavaScript to do stuff. Now, I need to send some of my results to the RabbitMQ in order to read them using another script. I mean, I want PhantomJS to communicate with RabbitMQ. To send some messages and to read some messages from the queue. Is that possible? Is there anyway by which PhantomJS can communicate with RabbitMQ?
PhantomJS is just another browser. That's exactly what the RabbitMQ Web-Stomp Plugin is for. It is based on SockJS which provides a web socket connection between browser and server. If web sockets are not available there are cross-browser fallbacks. PhantomJS supports web sockets from version 2 onwards.
If you don't open a page in PhantomJS, then you need to run this with the --local-to-remote-url-access=true option. I assume that sockjs-0.3.js and stomp.js are in the scripts directory.
page.injectJs('sockjs-0.3.js');
page.injectJs('stomp.js');
page.evaluate(function(){
var ws = new SockJS('http://127.0.0.1:15674/stomp');
window.client = Stomp.over(ws);
...
});
This has to run in the page context (inside of page.evaluate()). So that is why client is a global window property so that you can get a reference to the client with subsequent page.evaluate() calls. You can trigger calls from the page context to the outside by using window.callPhantom() and the page.onCallback event handler.
Related
I am currently trying to enable remote inspector for a OpenJFX web view component in order to be able to debug javascript code interactions with the Java part of the application. This is why I cannot debug the web part in a standalone browser.
There appears to be no detailed documentation related to remote inspector besides a few fixed scenarios which have pre-configured solutions available. Based on reverse-engineering and other research, I was able to piece together the following:
I have obtained an instance of Debugger interface out of the OpenJFX WebEngine instance;
I have created a simple TCP server which communicates with the WebKit browser using its protocol (eg. messages like "SetupInspectorClient", "GetTargetList", "SendMessageToBackend", etc.). This is enough to make the remote WebKit browser recognize my view when opening the inspector://localhost:<port> URI;
When attempting to connect to a particular view, the majority of the communication is handled by the "SendMessageToBackend" and "SendMessageToFrontend" messages forwarded by my code between remote WebKit browser and the Debugger instance. However, based on communication traces the only response that the remote browser receives to its requests is a "'Target' domain was not found" and "'Browser' domain was not found" errors.
I presume the above problem may be caused by either incompatible webkit versions between OpenJFX and my remote browser - although I am using WebKit 613.1 on both ends. Other possibility is that the OpenJFX uses some sort of stripped-down WebKit which does not support the inspector commands at all. However, I don't know enough about WebKit to be able to find it out on my own.
Is it possible to get remote inspector working in OpenJFX 17, and if yes, then how?
I'm attempting to write a prototype plugin for the Gravitee API gateway. I'd like to be able to use an interactive debugger to allow visibility into the API Gateway JVM. In order to do this, I need to introduce an "-agentlib" command line option onto the java command which runs the gateway. I tried setting the INSTALL4J_ADD_VM_PARAMS in the atom script, but that only seems to get applied to the Launcher JVM, and not to the actual Gateway JVM. I looked through the Gateway config files, but I don't see an obvious way of doing this.
I wanted to run a NoFlo application. I created a noflo component in json fomat and then I tried to run it with the following command:
./node_modules/.bin/noflo-nodejs --graph graphs/Number_game.json.
I got the following error:
NoFlo runtime is now listening at ws://192.168.43.64:3569 Browsers
will reject connections from HTTPS pages to unsecured WebSockets You
can use insecure version of the IDE, or enable secure WebSockets with
--tls-key and --tls-cert options Live IDE URL: http://app.flowhub.io/#runtime/endpoint?protocol%3Dwebsocket%26address%3Dws%3A%2F%2F192.168.43.64%3A3569%26id%3D173bb627-f1df-48cf-80da-d2b72546c08c%26secret%3Dtupiqiyoma
Component interaction/ListenChange not available with base C:\Users\DELL\Desktop\my-app
Can someone please help me with this issue?
(Sorry I can post images related to it because I am a new user)
noflo-interaction components are only available for browser environment. So they're not visible to noflo-nodejs.
I want to capture all the network calls from Web Driver in Java. I am not doing any UI testing, just testing JS execution and, requests and responses of some network calls.
I tried using Browser Mob as is suggested in most forums, but I need it to work across all browsers. It worked flawlessly with Firefox, but I was facing some issues with the others. Safari driver doesn't event support a Proxy capability.
I don't want to use Fiddler as it involves some manual steps around invoking and storing the calls. Whereas, Browser Mob being an in-code proxy can be integrated in a more smoother fashion.
I also tried using the RC-like package included in Selenium standalone server package. But, I have some HTTPS calls and some nested iframes in cross domains. I am particularly interested in some cross domain POST call and it doesn't work out that well. Also, people keep saying it's not recommended to use that package.
So, I had a solution where we can use a standalone proxy server running on a machine. Using host entries, we'll point Web Driver to hit the proxy instead of the actual server. The proxy will record all the incoming calls and route them to the actual server host. Later, I can make a request to the proxy which will return me all the calls it intercepted. I am not sure whether it's still called a proxy or a router.
I came across TCPmon, but it's no longer being supported. Does anyone know some similar tools that could run on Unix systems or any alternate solutions?
We modified the Fiddler rules script to include a new exec action. If you use their native script editor, it also provide auto complete features and we were comfortably able to get around it. The syntax is similar to that of JavaScript.
The Fiddler package comes with a ExecActions.exe which can be used to pass console arguments to a running Fiddler instance using the command prompt.
The code we wrote processed all the sessions captured by Fiddler and wrote it to a file in a custom JSON format and later used GSON to deserialize it.
Please let me know, if you want further details.
Is there any way to load background js even on error pages (such as net::ERR_NETWORK_CHANGED)? I need to keep persistence connection with WS server from the extension, but error pages don't load background js. So I lose the connection and possibility to restart it (due this is automated tool without access to browser ui).
The only solution I found is to use proxy server to customize error pages and load background js inside of them.
The assertion "Background js doesn't work on error pages" does not make any sense, because there's only one background page per extension two if you use split incognito mode.
So I assume that you want to detect a network connectivity loss in order to restore the web socket. Chrome offers two reliable global events for this: online and offline.
I have published the source code of Real-time desktop notifications for Stack Exchange inbox, which also accounts for network connectivity loss/regain. The relevant Web Socket part of the Chrome extension is found in stackexchange-notifications/Chrome/using-websocket.js on Github.