Socket.io失败并出现内部错误
我最近运行了npm install,它更新了我所有的软件包。 由于某种原因,这打破了我的networking服务器(每当我尝试加载一个页面,它只会加载部分的方式和死亡这个错误)。 我试着回滚版本的socket.io,redis和nodetime,它们是堆栈跟踪中显示的软件包,但是我没有让web服务器再次运行。 帮帮我? 我在OS X上运行。
events.js:66 throw arguments[1]; // Unhandled 'error' event ^ TypeError: First argument must be a Buffer at RedisClient.message (/Users/jchu/code/python/agles/ci/web/back/node_modules/socket.io/lib/stores/redis.js:126:24) at RedisClient.EventEmitter.emit (events.js:115:20) at RedisClient.return_reply (/Users/jchu/code/python/agles/ci/web/back/node_modules/socket.io/node_modules/redis/index.js:440:22) at RedisReplyParser.<anonymous> (/Users/jchu/code/python/agles/ci/web/back/node_modules/socket.io/node_modules/redis/index.js:81:14) at RedisReplyParser.EventEmitter.emit (events.js:88:17) at RedisReplyParser.add_multi_bulk_reply (/Users/jchu/code/python/agles/ci/web/back/node_modules/socket.io/node_modules/redis/lib/parser/javascript.js:311:14) at RedisReplyParser.send_reply (/Users/jchu/code/python/agles/ci/web/back/node_modules/socket.io/node_modules/redis/lib/parser/javascript.js:272:18) at RedisReplyParser.execute (/Users/jchu/code/python/agles/ci/web/back/node_modules/socket.io/node_modules/redis/lib/parser/javascript.js:222:22) at RedisClient.on_data (/Users/jchu/code/python/agles/ci/web/back/node_modules/socket.io/node_modules/redis/index.js:358:27) at Socket.<anonymous> (/Users/jchu/code/python/agles/ci/web/back/node_modules/socket.io/node_modules/redis/index.js:93:14)
你安装了MsgPack吗? 我用完之后
npm install msgpack
Socket.IO将显示您发布的确切错误。
我通过卸载MsgPack
npm uninstall msgpack
一切都很顺利 这不是解决问题的办法,但这是解决方法,让您的系统恢复运行。
不幸的是,MsgPack在我的项目中是必需的,所以我不能使用这里列出的答案。
相反,我发现这个网页: https : //github.com/LearnBoost/Socket.IO/wiki/Configuring-Socket.IO
这导致了我对这些代码的更改。
以前我有:
redis = require('redis'), redisPub = redis.createClient(), redisSub = redis.createClient(), redisClient = redis.createClient(), RedisStore = require('connect-redis')(express), sessionStore = new RedisStore({ client: redisClient }), socketRedisStore = require('socket.io/lib/stores/redis'), socketRedis = require('socket.io/node_modules/redis'), ... io.configure(function() { io.set('log level', 1); io.set('store', new socketRedisStore({ redisPub: redisPub, redisSub: redisSub, redisClient: redisClient })); io.set('authorization', function(data, accept) { ...
进入这个:
redis = require('redis'), redisPub = redis.createClient(), redisSub = redis.createClient(null, null, {detect_buffers: true}), redisClient = redis.createClient(), RedisStore = require('connect-redis')(express), sessionStore = new RedisStore({ client: redisClient }), socketRedisStore = require('socket.io/lib/stores/redis'), socketRedis = require('socket.io/node_modules/redis'), ... io.configure(function() { io.set('log level', 1); io.set('store', new socketRedisStore({ redis: redis, redisPub: redisPub, redisSub: redisSub, redisClient: redisClient })); io.set('authorization', function(data, accept) { ...
请注意包含redisSub中的选项,检测缓冲区,然后将基本redis对象注入到socket.io存储configuration中。
- cookie-Sessions和connect-cookie-session之间的明显区别
- 尝试使用mongoose / mongodb-native执行mongodb查询时出现RangeError错误
- 在Cygwin for JStesting中,如何开始使用YUI YETI需要帮助
- Nodejs和连接“下一个”function
- node.js swf提取definebitslossless2不正确的像素
- findByIdAndUpdate当我尝试更新属性为null时抛出转换错误
- 简单的http服务器
- 在Node.JS中使用Bluebird Promise和2个asynchronous操作
- 是否有可能使用NodeJS / Angular从DynamoDB获取唯一值?
- 如何从NodeJs / express / mongoose中的对象中删除项目?
- 如何使用节点js将多个logging插入到oracle数据库中