Tic Tac Toe AppEngine 通道示例机制
问候先生,
编辑:忘记了示例的链接,这里是:http://code.google.com/p/java-channel-tic-tac-toe/source/browse/trunk/src/com/google/appengine/demos/channeltactoe/
因此,我正在研究 AppEngine 的通道 API,并且偶然发现了一个有关其架构编码方式的问题。我认为它的工作方式是客户端发送标准 POST 请求,游戏得到更新,并且两个玩家通过 ChannelService 获取更新 JSON 消息。
现在我在 javadoc 上读到 Channel 是一个双向通信通道,那么为什么这个开发人员选择 POST servlet(用于游戏更新)和 Channel 进行分发,而不是使用单个 servlet 来单独创建 Channel 和然后使用该通道进行客户端和服务器之间的前端和后端游戏更新通信?
总而言之,这种架构比使用真正的 2 路通道有什么好处,或者甚至可以以这种方式使用 2 路(返回服务器通道)。
感谢您的阅读,我希望我的问题是有效的/可以理解的。
-罗汉
Greetings gents,
EDIT: forgot the link to the sample, here it is: http://code.google.com/p/java-channel-tic-tac-toe/source/browse/trunk/src/com/google/appengine/demos/channeltactoe/
So i'm studying the channel API of AppEngine and i stumbled onto a question regarding the way it's architecturally coded. They way i perceive it works is the clients send standard POST requests, the game gets updated and the both players get the update through the ChannelService a JSON message.
Now i read on the javadoc that Channel is a two-way communication channel, so why did this developer go for the POST servlets(for game-updates) and Channel for distribution instead of using a single servlet for the sole creation of the Channel and then using that channel for front and back game updates communication between the client and server?
To summerize, what did does this architecture gain over using a true 2-way channel, or is it even possible to use the 2-way(back to server channel) in that way.
Thank you for reading, i hope my question is valid/understandable.
-Rohan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道你在哪里读到通道是双向的;他们不是。通道仅用于从服务器向客户端发送消息。客户端通信必须使用标准 HTTP 请求。
I don't know where you read that Channels are bi-directional; they're not. Channels are solely for sending messages from the server to the client. Client communications have to utilize standard HTTP requests.