JBoss AeroGear JavaScript notifier is a set of adapters that provide a unified / similar API for interacting with various messaging services and protocols.
Question
I am writing several QUnit tests for JBoss AeroGear JS MQTT through a WS adapter , which depends on the Eclipse Paho MQTT JavaScript client. Tests work on Firefox / Chrome, but crash on PhantomJS 1.9.7 with connection error AMQJS0008I Socket closed .
Initially, my tests were run against the Apache Active MQ broker version 5.9.0, which supports MQTT on top of WebSockets out of the box. I also modified them to use the Eclipse Paho MQTT environment on top of the WebSockets ws://iot.eclipse.org/ws , but the problem still exists.
How to reproduce?
Clone my GitHub repository https://github.com/tolis-e/aerogear-js-integration . End the stackoverflow branch, do npm install , and then grunt integration-iot --debug . To check if tests work on Firefox / Chrome, open tests/notifier/mqttws.html in a browser. QUnit tests are located inside the mqttws.js file. As you can see in the logs below, I get the error AMQJS0008I Socket closed .
Any idea on the cause of the error? I believe the problem is that PhantomJS 1.9.7 does not support RFC 6455 web sockets. It seems that RFC 6455 will be supported by PhantomJS 2.x
Magazines
[D] ["phantomjs","qunit.begin"] [D] ["phantomjs","onLoadFinished","success"] [D] ["phantomjs","qunit.moduleStart","Connect / Disconnect"] [D] ["phantomjs","qunit.testStart","Connect to and Disconnect from MQTT Server"] [D] ["phantomjs","console","Unexpected response code: 404"] Unexpected response code: 404 [D] ["phantomjs","console","Connection error: AMQJS0008I Socket closed."] Connection error: AMQJS0008I Socket closed. [D] ["phantomjs","fail.timeout"]