stomp-js / stomp-websocket

Stomp client for Web browsers and node.js apps
https://stomp-js.github.io/stomp-websocket/
Apache License 2.0
141 stars 36 forks source link

"value instanceof Function" used rather than "typeof value === 'function'" #38

Closed seamusmac closed 6 years ago

seamusmac commented 6 years ago

I was trying to integrate our GWT application to this stomp-js library. I believe it the most official project for stomp-js?

i discovered that its not calling the correct parseConnect args lines, due to instance of not working over iframes etc.

Could the parseConnect() function be updated to support GWT properly?

from if (args[1] instanceof Function) { to if (typeof args[1] === 'function' ) {

See https://github.com/paypal/paypal-checkout/issues/626 && https://github.com/webcomponents/custom-elements/issues/64#issuecomment-282686071 for similar issues.

kum-deepak commented 6 years ago

Made this change in the GWT-compat branch. Please test by installing from that branch:

$ npm install stomp-js/stomp-websocket#GWT-compat
seamusmac commented 6 years ago

Shouldn't there be a triple equals in that change to avoid type conversion?

kum-deepak commented 6 years ago

The file you are checking is probably the .cofee file, which gets compiled to .js.

Please check https://github.com/stomp-js/stomp-websocket/blob/30bf29ec0219c1333de0b977d5434242b2b0cf85/lib/stomp.js#L258

seamusmac commented 6 years ago

Indeed!! You are right sir. Thank you very much. I tested it locally and it all works properly now.

I used https://github.com/gordon00/gwt-stomp and extended it to support the reconnect functionally

kum-deepak commented 6 years ago

Released 4.0.4 with this change.

kum-deepak commented 6 years ago

Planning for next version of stompjs is on the way. Your participation will be really appreciated, please join at https://github.com/stomp-js/stompjs/issues/1