9

The JBoss AeroGear JavaScript notifier is a collection of adapters which provide a unified/similar API for interacting with different messaging services and protocols.

Issue

I'm writing some QUnit tests for the JBoss AeroGear JS MQTT over WS adapter which depends on the Eclipse Paho MQTT JavaScript client. The tests work on Firefox/Chrome but fail on PhantomJS 1.9.7 with AMQJS0008I Socket closed connection error.

Initially, my tests were running against an Apache Active MQ broker version 5.9.0 which supports MQTT over WebSockets out of the box. I've also modified them to use the Eclipse Paho MQTT over WebSockets sandbox environment 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. Checkout the stackoverflow branch, execute npm install and then grunt integration-iot --debug. In order to verify that the tests are working on Firefox/Chrome, open the tests/notifier/mqttws.html in a browser. The QUnit tests are located inside the mqttws.js file. As you can see at the logs below, I'm getting a AMQJS0008I Socket closed error.

Any idea about the error cause? My sense is that the issue is related to the fact that PhantomJS 1.9.7 does not support Web Sockets RFC 6455. It looks like RFC 6455 will be supported by PhantomJS 2.x

Logs

[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"]
Apostolos Emmanouilidis
  • 7,179
  • 1
  • 24
  • 35

0 Answers0