【发布时间】:2018-07-01 16:54:55
【问题描述】:
我正在尝试修改游戏,但 websocket 显示名称未解析,即使它看起来应该可以工作。谁能告诉我问题所在?
function doit() {
document.body.innerHTML += '<div id="messageDisplay"></div>';
messageDisplay = document.getElementById("messageDisplay");
y = E.getElementById("canvas");
a = y.getContext("2d");
try {
A.top.location.origin != A.location.origin && ba()
} catch (f) {
ba()
}
y.onmousemove = ua;
y.onmousedown = va;
y.onmouseup = xa;
M = E.getElementById("noCursorLock");
H = E.getElementById("noDrawings");
null != localStorage && (M.checked = "1" == A.localStorage.getItem("noCursorLock") ? !0 : !1, H.checked = "1" == A.localStorage.getItem("noDrawings") ? !0 : !1);
A.onbeforeunload = ya;
y.requestPointerLock = y.requestPointerLock || y.mozRequestPointerLock || y.webkitRequestPointerLock;
y.style.cursor = "none";
La();
//________________
//the main issue V
D || null == u && (u = new WebSocket("ws://s1.cursors.io:443/"), u.binaryType = "arraybuffer", u.onopen = Aa, u.onmessage = Ga, u.onclose =
Ba, u.onerror = Ca);
//______________
setInterval(Q, 50);
setInterval(Ja, 40);
A.requestAnimationFrame(ma)
document.onkeypress = handleKeyboard;
}
顺便说一句,这不是我做的,我只是想修复它。
编辑:错误是连接建立错误
编辑2:所以上面的问题得到了解决,但又出现了一个新问题。我用104.27.159.114 替换了s1.cursors.io,但它说VM20349:1898 WebSocket connection to 'ws://104.27.159.114:443/' failed: Error during WebSocket handshake: Unexpected response code: 400 现在出了什么问题?
【问题讨论】:
标签: javascript websocket java-websocket