我需要通过套接字发送消息(来自用户的请求到引擎,以及从引擎到用户的响应).所以流程本质上是
+--------+ serialized request +--------+
| Server | <==== network ====> | Client |
+--------+ serialized response +--------+
^ ^
| request/response | mouse/keyclicks
| object |
v v
+--------+ +--------+
| Engine | | User |
+--------+ +--------+
Run Code Online (Sandbox Code Playgroud)
现在,在这里重新发明轮子才有意义.我正在处理双方的Java,所以我计划使用像这样的对象:
/**
* A Client makes a Request.
*/
abstract class UserRequest implements Serializable {
/**
* The engine will call request.engineCallback(this);
* This will tell the Engine what the request is, at which point
* the Engine will determine its …Run Code Online (Sandbox Code Playgroud)