我在 Javascript 中使用 Fancy WebSockets 与我的多人游戏 php 服务器通信。
但是现在,我只是发送原始套接字(json)作为
Sending: {"command": "login", "data": {"id" : "1575","md5" : "6bd8937a8789a3e58489c4cfd514b1a7","username": "densortekat"}} index.php:58
Sending: {"command": "inroom"} index.php:58
Reciveing: {"command": "roombg","data" : "shop.png"} index.php:83
Reciveing: {"command" : "NEWUSER","data" : { "username" : "densortekat","seat_id" : "29","room_id" : "9"}} index.php:83
Sending: {"command" : "move", "data" : { "seat_id" : "53"}} index.php:58
Reciveing: {"command": "move", "data" : {"username" : "densortekat", "seat_id" : "53"}} index.php:83
Sending: {"command": "request_trade", "data" : "densortekat"} index.php:58
Reciveing: {"command":"trade", "data": {"username":"densortekat"}} index.php:83
Sending: {"command":"ping"}
我的问题是,我如何从 javascript 到 PHP 以及 PHP->Javascript 加密数据的相同方式,以便其他人看不到发生了什么?
最佳答案
参见 html5 Websocket with SSL - 如果您的初始页面是 HTTPS (SSL/TLS),那么它上面的 websockets 也是。
关于php - 通过客户端和服务器的安全命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14919656/