Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[paho-dev] Minified version of Javascript client is broken

Hi,

The _javascript_ client seems to be broken when minified, I've raised a bug here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=469700, but thought I would pop it on the mailing list as well.

It seems that the YUI Compressor is not renaming the Message getters and setters correctly during compression:

Non- Compressed:

get payloadBytes() { return this._getPayloadBytes(); },

YUI Compressed:

get payloadBytesfunction() {
            return this._getPayloadBytes()
},

I've tried compressing using Google Closure and JSmin and they seem to compress correctly.

Closure Compressed:

get payloadBytes() {
            return this._getPayloadBytes()
},

JSmin Compressed:

get payloadBytes() {
            return this._getPayloadBytes();
},

Because of this, when you try to publish a message, the following error is shown:

Uncaught TypeError: Cannot read property 'byteLength' of undefined mqttws31-min.js:15
Paho.MQTT.q.encode mqttws31-min.js:15
Paho.MQTT.v._socket_send mqttws31-min.js:15
Paho.MQTT.v._process_queue mqttws31-min.js:15
Paho.MQTT.v._schedule_message mqttws31-min.js:15
Paho.MQTT.v.send mqttws31-min.js:15
Paho.MQTT.p.send mqttws31-min.js:15



Because it has been renamed to payloadBytesFunction, it does not work when the following code is executed:

var F = this.payloadMessage.payloadBytes;
K += F.byteLength;

Is changing the maven build to use closure or JSMin the best solution? Or is there something better we could do?


Kind regards,

James Sutton
Software Engineer - IoT Foundation

Phone: 44-1962 81 x372454
E-mail:
james.sutton@xxxxxxxxxx
Personal Website:
www.jsutton.co.uk
Find me on:
LinkedIn: http://uk.linkedin.com/in/jpwsutton  WordPress: http://www.jsutton.co.uk/  Facebook: http://twitter.com/jpwsutton 
IBM

Hursley Park
Hursley, SO212JN
United Kingdom



IBM United Kingdom Limited Registered in England and Wales with number 741598 Registered office: PO Box 41, North Harbour, Portsmouth, Hants. PO6 3AU
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU

Back to the top