var codestring = this.ball + " " + this.ball.position["x"] + " "
+ this.ball.position["y"];
_warpclient.sendPrivateUpdatePeers(enemy, codestring);我使用此函数将同级发送给具有已定义名称敌手的人。
function onSendPrivateUpdateDone (result){
console.log('Update done ' + result);
}onSendPrivateUpdateDone工作并向发送同级的人写消息,这里https://apphq.shephertz.com/appWarp/index#/testManager注意到我的消息发送了,房间创建了,播放器连接到了房间,但是必须接受消息的人不会这样做,因为onPrivateUpdateReceived回调函数什么也不做。
onPrivateUpdateReceived(userName, msg){
console.log("Username: "+userName);
console.log("Message: "+msg);
}发布于 2018-08-19 07:25:48
onPrivateUpdateReceived从tosendPrivateUpdate方法接收消息,您应该将sendPrivateUpdatePeers更改为sendPrivateUpdate才能工作。
https://stackoverflow.com/questions/46439474
复制相似问题