NetEase / pomelo-cocos2d-js

pomelo-cocos2d-js client
101 stars 64 forks source link

TypeError: buffer.readUInt8 is not a function #13

Closed jackiesun8 closed 9 years ago

jackiesun8 commented 9 years ago

新版的使用方法赞一下。 现在报这个错,是怎么回事呢?

fantasyni commented 9 years ago

在什么情况下会出现这个错误?

jackiesun8 commented 9 years ago

@fantasyni 我就直接添加进js文件,然后添加了示例代码,就提示这个错误了。cocos2d-js版本是3.5

fantasyni commented 9 years ago

浏览器还是native跑的?

jackiesun8 commented 9 years ago

@fantasyni native的错误是:pomelo-cocos2d-js/dist/pomelo-cocos2d-js.js:3283:TypeError: buffer.readUInt8 is not a function,浏览器的错误是::8001/pomelo-cocos2d-js/dist/pomelo-cocos2d-js.js:3283 Uncaught TypeError: undefined is not a function

jackiesun8 commented 9 years ago

@fantasyni 经查,是服务器推送onChat消息时触发的,因为onChat有开启protobuf压缩,所以才报了上面的错误。目前buffer的类型是Uint8Array,所以没有readUInt8方法,nodejs里面的Buffer模块才有readUInt8方法

jackiesun8 commented 9 years ago

这个问题该怎么解决呢?