Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 模拟器上可以,真机上失败了 #1

Open
gengjiawen opened this issue May 7, 2018 · 7 comments
Open

[Bug] 模拟器上可以,真机上失败了 #1

gengjiawen opened this issue May 7, 2018 · 7 comments
Labels
good first issue Good for newcomers

Comments

@gengjiawen
Copy link

看了下日志,模拟器上时发送的时候是Uint8Array,真机上Object,不知道是不是这个原因。

@gengjiawen
Copy link
Author

看了下日志,好像发送不成功,微信也没有报错,但是服务器没有收到。

@gengjiawen
Copy link
Author

微信那边有bug,具体hack的方法,我贴到这里了 https://developers.weixin.qq.com/blogdetail?action=get_post_info&docid=0c1e8e0253176ecf0b2212d8fb57ff21

  const message = Hello2Server.create(msg)
  const encodedMessage = Hello2Server.encode(message).finish()
  console.log(`hello:`, encodedMessage)
  let newMsg = encodedMessage
  if (sysInfo.platform !== 'devtools') {
    newMsg = new Uint8Array([...encodedMessage]).buffer
  }
  console.log('newMsg:', newMsg)
  wx.sendSocketMessage({
    data: newMsg
  })

@Zhang19910325
Copy link
Owner

很感谢你的Issue,你应该用到了微信websocket部分。这个工具序列化出来的是类型Uint8Array的数据,但是微信websocket的api 要求发送数据的是String/ArrayBuffer类型:具体可见:https://developers.weixin.qq.com/miniprogram/dev/api/network-socket.html#wxsendsocketmessageobject;所以针对你的问题其实你已经给出答案了,只要取Uint8Array中的buffer就可以了,所以可以将你上部分代码改成如下;如果真机的websocket成功建立连接的话,应该可以发送成功。😁

const message = Hello2Server.create(msg)
const encodedMessage = Hello2Server.encode(message).finish()
console.log(`hello:`, encodedMessage)
let newMsg = encodedMessage.buffer
console.log('newMsg:', newMsg)
wx.sendSocketMessage({
data: newMsg
})

@gengjiawen
Copy link
Author

@Zhang19910325 你觉得你把这个publish到npm怎么样,我觉得这样会方便很多

@Zhang19910325 Zhang19910325 added the good first issue Good for newcomers label May 23, 2018
@littleferry
Copy link

这样写,在IOS真机上,确实可以发送,但是在server端接收我遇到问题
server端我用nodejs实现的,代码如下:
var server = ws.createServer(function (wsconnect) {
console.log(" [-] createServer ok");
wsconnect.on("binary", function (inStream) {
//接收客户端发送的binary消息
var data = new Buffer(0);
inStream.on("readable", function () {
var newData = inStream.read();
if (newData) {
console.log("recv ws client newData length: " + newData.length);
data = Buffer.concat([data, newData], data.length + newData.length);
console.log("recv ws client data.length: " + data.length);
}
});
inStream.on("end", function () {
if (data) {
console.log("recv ws client data.length: " + data.length);
console.log(data);
}
});
});

从日志看,newData.length和data.length都是8192,导致后续的Msg decode有时正常,有时异常

但是如果用模拟器的话,不会出现这个问题,length都是正常的,不是8192,我看8192的十六进制是:0x2000

所以个人感觉,还是在client生成的buffer的问题,但是从ios手机上输出buffer,只能看到是个Object,看不到length

@littleferry
Copy link

我在模拟器上做了这样的尝试,把encode.finish得到的数据msg取出msg.buffer进行base64,发现数据长度确实有问题,问题症结点应该是
var msg = pbmsg.encode().finish();
msg.buffer得到的ArrayBuffer对象打印不出,但是我推测它的长度是8192,msg.length的长度确实是92没有错误,但是取出msg.buffer的长度变成了8192,服务器收到的长度也变成8192,导致在服务器端decode时有时正常,有时出错

wx.sendSocketMessage msg: Uint8Array(92) [8, 1, 18, 88, 10, 14, 49, 56, 48, 46, 49, 53, 48, 46, 49, 56, 54, 46, 52, 50, 16, 168, 44, 26, 6, 104, 113, 121, 120, 109, 113, 34, 8, 49, 50, 51, 121, 120, 51, 50, 49, 42, 3, 47, 121, 120, 50, 20, 51, 95, 49, 53, 52, 49, 49, 52, 57, 49, 55, 54, 57, 51, 49, 50, 57, 55, 50, 56, 58, 20, 51, 95, 49, 53, 52, 49, 49, 52, 57, 49, 55, 54, 57, 51, 49, 50, 57, 55, 50, 56, 66, 0]
canvas.js? [sm]:243 wx.sendSocketMessage base64: CAESWAoOMTgwLjE1MC4xODYuNDIQqCwaBmhxeXhtcSIIMTIzeXgz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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=

@willing8310
Copy link

@littleferry 用msg.slice().buffer就能得到正确长度的buffer 参考 protobufjs/protobuf.js#852

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants