Handle invalid msgpack messages sent from IE10
Asked Answered
C

1

6

We have an application that communicate with backend via WS. We encode all messages with msgpack-lite, library specification said that it supports IE10. In all modern browsers like Chrome, Firefox, Safari and Edge all works well. But in IE10 we caught a strange situation:

msgpack-lite encodes message to the same binary as in other browsers BUT after sending encoded message to the backend this binary message changes.

Example.

Our message that we want encode and send to the backend:

{
  "method": "subscribe",
  "data": {
    "sports": [
      85
    ]
  }
}

Encoded message (backend also handle the same data sent from all browsers except IE10):

[130 166 109 101 116 104 111 100 169 115 117 98 115 99 114 105 98 101 164 100 97 116 97 129 166 115 112 111 114 116 115 145 85]

Handled message that had sent from IE10:

[239 191 189 239 191 189 109 101 116 104 111 100 239 191 189 115 117 98 115 99 114 105 98 101 239 191 189 100 97 116 97 239 191 189 239 191 189 115 112 111 114 116 115 239 191 189 85]

So our question is: how can binary data changed during sending via websockets in IE10?

Countrified answered 18/5, 2017 at 12:7 Comment(0)
T
0

I believe the issue resides in the fact IE 10 is the only browser that doesn't implement Uint8ClampedArray, which is used by msgpack-lite.

I would try to add a polyfill for this type, you can find one here which is pretty lite but untested, or the typedarray module if you're experiencing troubles still.

It's strange that the encoding part is working and the sending is what's converting the payload, but that might still be an explanation since that's one of the huge differences between the other browser counterparts.

Thaddeus answered 20/5, 2017 at 15:12 Comment(2)
Thanks for your answer. Looks like msgpack-lite works well. We will check your advice soon and I'll give you feedback about results.Countrified
Hm, seems like your suggestion doesn't help. msgpack-lite generate correct result both with and without polyfill.Countrified

© 2022 - 2024 — McMap. All rights reserved.