crossbario / autobahn-js

WAMP in JavaScript for Browsers and NodeJS
http://crossbar.io/autobahn
MIT License
1.43k stars 228 forks source link

CBOR transport serializer: make it work in browser builds #466

Closed oberstet closed 2 years ago

oberstet commented 5 years ago

currently, cbor transport serialization does not work in the browser build, and in fact we deactivate the dependency for the browser build in package.json:

  "browser": {
    "cbor": false,
    "ws": false,
    "./lib/transport/rawsocket.js": false
  },

there are 2 issues .. the first is that the google closure compiler fails:

build/autobahn.js:13709: ERROR - [JSC_CANNOT_CONVERT] This code cannot be converted from ES6. extending native class: Map
  constructor(iterable) {
  ^^^^^^^^^^^^^^^^^^^^^^^

when deactivating google closure (skipping library minimization), receiving messages then runs into:

CBOR decoding error Error: Insufficient data
    at Object.decodeFirstSync (autobahn.js:12390)
    at CBORSerializer.unserialize (autobahn.js:2967)
    at WebSocket.websocket.onmessage (autobahn.js:5031)

no clue why .. so needs investigation.

note: the cbor library itself does work (in browser), as we still use it in XBR for e2e encrypted payload serialization .. which is even more strange: why does that work, while above does not?

oberstet commented 4 years ago

Elad has pointed me to https://github.com/crossbario/autobahn-js/issues/286#issuecomment-322461577, which according to OP works from browser.

We should try that .. and if it works, use it at least on browsers.

om26er commented 2 years ago

This works now with the latest release 22.10.1