为什么服务器不接受键盘发送的特定值?
在浏览器控制台中,显示值,例如:w, s, d, a
在服务器控制台中,这些值是这样显示的:[object KeyboardEvent], [object KeyboardEvent], [object KeyboardEvent], [object KeyboardEvent]
如何让服务器准确地接受客户端从键盘发送给它的值?
JS:
document.onkeypress = function(event) {
console.log(event);
ws.send(event);
}
1 个回答