socket.io-redis-adapter icon indicating copy to clipboard operation
socket.io-redis-adapter copied to clipboard

Exception error with msgpack

Open cong88 opened this issue 10 years ago • 4 comments

I had exception error when using "socket.io": "1.3.7", "socket.io-redis": "0.2.0", nodejsV4 My config: var pub = redis(socket_redis.port, socket_redis.host); var sub = redis(socket_redis.port, socket_redis.host, { return_buffers: true });

Error: 367 trailing bytes at Object.decode (/var/www/api/node_modules/msgpack-js/msgpack.js:200:47) at Redis.onmessage (/var/www/api/node_modules/socket.io-redis/index.js:93:24) at emitTwo (events.js:87:13) at RedisClient.emit (events.js:172:7) at RedisClient.return_reply (/var/www/api/node_modules/redis/index.js:618:22) at /var/www/ibooknail-api/node_modules/redis/index.js:309:18 at doNTCallback0 (node.js:419:9) at process._tickDomainCallback (node.js:389:13)

cong88 avatar Dec 18 '15 02:12 cong88

Have you solved the problem? After upgrading node to 4.2, I'm getting similar errors. I have downgraded socket.io to 1.36, redis to 1.0.
I have followed the solutions suggested in https://github.com/socketio/socket.io-redis/issues/17, but they don't work.

Adding return_buffers: true to the instances doesn't do anything.

Tried changing the dependencies to msgpack-js-v5 suggested in the last post but that isn't working.

Error: 256 trailing bytes
    at Object.decode (/usr/apps/js/node_modules/msgpack-js/msgpack.js:200:47)
    at Redis.onmessage (/usr/apps/js/node_modules/socket.io-redis/index.js:93:24)
    at emitTwo (events.js:92:20)
    at RedisClient.emit (events.js:172:7)
    at RedisClient.return_reply (/usr/apps/js/node_modules/redis/index.js:676:22)
    at JavascriptReplyParser.reply_parser.send_reply (/usr/local/apps/js/node_modules/redis/index.js:332:14)
    at JavascriptReplyParser.run (/usr/apps/js/node_modules/redis/lib/parsers/javascript.js:132:18)
    at JavascriptReplyParser.execute (/usr/apps/js/node_modules/redis/lib/parsers/javascript.js:107:10)
    at Socket.<anonymous> (/usr/apps/js/node_modules/redis/index.js:131:27)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at readableAddChunk (_stream_readable.js:146:16)
    at Socket.Readable.push (_stream_readable.js:110:10)
    at TCP.onread (net.js:523:20)

laukaichung avatar Jan 08 '16 11:01 laukaichung

@stonecold123 ,

check #17 comments. change version is work fine.

xyzlast avatar Feb 25 '16 17:02 xyzlast

Not any error when I use default setting and make sure 2 node server had the same version var io = require('socket.io')(3000); var redis = require('socket.io-redis'); io.adapter(redis({ host: 'localhost', port: 6379 }));

ORr using version : "1.0.0" :+1:

cong88 avatar Feb 26 '16 06:02 cong88

@cong88

I want to know the default setting value. I've set this versions in packages.js. I've met the error when subClient and pubClient is used.

const server = require('http').createServer(app),
  io = require('socket.io')(server),
  adapter = require('socket.io-redis');
const pub = require('./app/utils/RedisUtil').createClient();
const sub = require('./app/utils/RedisUtil').createClient();
io.adapter(adapter({ pubClient: pub, subClient: sub }));
    Node: 5.6.0
    "socket.io": "^1.4.5",
    "socket.io-adapter": "^0.4.0",
    "socket.io-redis": "^1.0.0",

xyzlast avatar Feb 29 '16 07:02 xyzlast