socket.io-redis-adapter: Some error occuered after update 3.0.0

I update socket.io-redis 3.0.0 right now, But few Unknown error occured from error logs.

msgpack-js:msgpack in Decoder.parse
error: Unknown type 0xc7
msgpack-lite.lib:flex-buffer in DecodeBuffer.reserve
error: BUFFER_SHORTAGE
msgpack-js:msgpack in Object.decode
error-686655034 trailing bytes

Maybe It caused by "msgpack-lite": "0.1.26"

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 25 (16 by maintainers)

Most upvoted comments

msgpack is the problem. I think that the encoded message is somewhere parsed through .toString() this results that in the encoded message sometimes data gets lost. Below did i included the same message with the second one after encoding parsed through .toString(). You see that \u0002 disappears.

Not parsed ��YMf4EB��type\u0002�data��hi�nsp�/��except��BoOzf02kzKgSjGSuAAAA�roomsĥflags��broadcast�

Parsed ��YMf4EB��type�data��hi�nsp�/��except��BoOzf02kzKgSjGSuAAAA�roomsĥflags��broadcast�

A simple but maybe dirty and temporarily fix is to replace msgpack with JSON (stringify | parse) this resolves the problem.

I get the same error i dived into socket.io-redis and found that i can encode and decode my payload gets correctly encoded with a length of 85 characters but when the message get’s received is the encoded message 84 characters long.

The payload:

[ 'ATcq1N', { type: 2, data: [ 'hi' ], nsp: '/' }, { except: [ 'qeoUFZeGyBlewzL_AAAA' ], rooms: undefined, flags: { broadcast: true } } ]

example

line where message get’s encoded

line where message get’s decoded

@darrachequesne i can’t argue with that logic. I’ll give it a go this evening and see what results I get.

Cheers

Yes of course. I use socket.io-emitter and I just upgraded few hours ago both socket.io-emitter and socket.io-redis

npm ls msgpack-lite
└└──┬┬ socket.io-emitter@2.0.0
  └└──── msgpack-lite@0.1.26

and there is no usage msgpack-js