谷歌应用程序引擎可以用作套接字服务器吗?
我的虚拟主机对套接字服务器有规则,所以我一直在研究 GAE。
有谁知道可以在GAE上成功运行的socket服务器吗?我将它用于闪光灯,所以如果可能的话,像 smartfox 这样的东西会很棒。
谢谢。
My webhost has rules against socket servers so I've been looking into GAE.
Does anyone know of a socket server that can successfully run on GAE? I'm using it for flash so anything like smartfox would be amazing if it's possible.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Google App Engine 现在拥有 Channel API
Channel API 在您的应用程序和 Google 服务器之间创建持久连接,允许您的应用程序实时向 JavaScript 客户端发送消息,而无需使用轮询。这对于旨在立即向用户更新新信息的应用程序非常有用。一些示例用例包括协作应用程序、多人游戏或聊天室。一般来说,在更新无法预测或编写脚本的情况下,例如在人类用户之间或非系统生成的事件中传递信息时,使用 Channel API 是比轮询更好的选择。 - 取自以下链接
http://code.google.com/appengine /docs/python/channel/overview.html
更新:2016 年 10 月 27 日
Channels API 已被弃用,并计划于2017 年 10 月 31 日
https://cloud.google.com/appengine/docs/deprecations/channel
Google App Engine has Channel API now
The Channel API creates a persistent connection between your application and Google servers, allowing your application to send messages to JavaScript clients in real time without the use of polling. This is useful for applications designed to update users about new information immediately. Some example use-cases include collaborative applications, multi-player games, or chat rooms. In general, using the Channel API is a better choice than polling in situations where updates can't be predicted or scripted, such as when relaying information between human users or from events not generated systematically. - taken from the link below
http://code.google.com/appengine/docs/python/channel/overview.html
Update: October 27, 2016
Channels API has been deprecated and scheduled to be turned down by 31st October, 2017
https://cloud.google.com/appengine/docs/deprecations/channel
GAE 不支持套接字。更多支持/不支持的 infp 位于:
http://groups.google.com/group/google-appengine-java/web/will-it-play-in-app-engine?pli=1
Sockets are not supported on GAE. More supported/not supported infp here:
http://groups.google.com/group/google-appengine-java/web/will-it-play-in-app-engine?pli=1
我可以确认我有一个使用 canvas/GWT/App Engine 的多人游戏,并使用通道 api 运行。我使用内存缓存来保存当前状态,并让客户端向服务器报告其当前状态,然后,如果经过一定时间,服务器将向所有客户端广播新状态(以防止它经常发送,如果您拥有大量用户)。这种方法似乎占用了大量的CPU能力,但是,目前我的方法是在服务器上有最少的逻辑,这意味着有很多黑客攻击等的机会。多人交互需要一些工作,但我有玩家在其他客户端上移动大约有半秒的延迟,这也是因为我没有直接显示最后一个已知的位置,而是在旧位置和最后一个已知的位置之间进行插值。如果有人有更好的方法来了解如何在谷歌应用程序引擎上执行此操作而不是使用内存缓存,请告诉我。
I can confirm that i have a multiplayer game using canvas/GWT/App Engine up and running using the channels api. Im using the memcache to hold the current state and have the clients report in to the server with their current state, the server will then broadcast the new state to all clients if a certain time has passed ( to keep it from sending to often if you have a high number of users ). This approach seems to take up a bunch of cpu power however, currently my approach is to have a bare minimum of logic on the server, wich means there are a lot of openings for hacks etc.. The multiplayer interaction needs some work but i have players moving within aprox a half of a seconds delay on other clients, thats also because im not showing the last known posiiton directly, im interpolating between the old position and the last known. If anyone has a better approach on how to do it on google app engine instead of using the memcache please let me know.
从 1.7.2 版开始,通过注册受信任的测试人员即可支持套接字
http: //googleappengine.blogspot.com/2012/09/app-engine-172-released.html
Socket is now supported since 1.7.2 by signing up trusted tester
http://googleappengine.blogspot.com/2012/09/app-engine-172-released.html