Facebook Flash 游戏客户端-服务器通信

发布于 2024-11-18 20:50:28 字数 358 浏览 3 评论 0原文

我们目前正在为 Facebook 开发一款小型独立纸牌游戏,我们希望该游戏能够(最终)吸引数十万玩家。

我们已经解决了大部分问题(可扩展性、服务器端架构等)——但是有一个问题——客户端和服务器之间的通信。服务器。

我们有以下要求:

  • 服务器端推送消息(无客户端消息请求)
  • 高可扩展性(最初应支持数百个,后来希望支持数千个 CCU)
  • 安全、可靠的层
  • 与大多数计算机、路由器和应用程序兼容。浏览器
  • 与 Adob​​e Flash/AS3 配合使用

首先想到的是套接字连接,但我想知道是否有更好的解决方案可以满足我们的需求?

谢谢!

We're currently working on a small scale indie card game for Facebook, which we hope will reach hundreds of thousands of players (eventually).

We have most of the issues figured out (scalability, server-side architecture, etc) - however one question - communication between client & server.

We have the following requirements:

  • Server side push messages (no client message request)
  • High scalability (should support at first hundreds and later hopefully thousands of CCUs)
  • Secure, reliable layer
  • Work well with most computers, routers & browsers
  • Works with Adobe Flash/AS3

First thing that came to mind was socket connections, but I was wondering, is there a better solution that answers our needs?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

酒中人 2024-11-25 20:50:28

套接字连接几乎是不可避免的(请参阅传输层)。

一个好主意是使用 TCP:它保证交付(高可靠性),它是面向“连接”的。虽然有一些缺点,但大多数计算机、路由器和浏览器都没有其他替代方案。

一个更重要的问题是:您要通过 TCP 发送什么?一般来说,最好使用可以在 Flash 和服务器中使用的东西(请参阅远程过程调用 例如)。

“推送”消息通常只是 HTTP 连接的问题,因为它是为处理同步请求而设计的。但是,在 Flash 中则没有此限制。

可以通过“包装” TCP 连接来添加安全性:使用 SSL 或 TLS。

  • XML序列化(XML-RPC):易于开发和维护,性能中等,也许可靠。
  • RTMP(实时消息协议):Flash 原生,性能出色,非常适合实时游戏,并且可以通过 HTTP 进行隧道传输(以超越任何防火墙/路由器)。

请参阅 NetConnection 类和 操作消息格式

Adobe Integrated Runtime 和 Adob​​e Flash Player 使用 AMF 在应用程序和远程服务器之间进行通信。 AMF 将远程过程调用 (RPC) 编码为紧凑的二进制表示形式,可以通过 HTTP/HTTPS 或 RTMP/RTMPS 协议进行传输。对象和数据值被序列化为这种二进制格式,从而提高了性能,使应用程序加载数据的速度比基于文本的格式(例如 XML 或 SOAP)快 10 倍。

(来自 http://www.pyamf.org/

A socket connection is almost inevitable (see transport layers).

A good idea is to use TCP: it guarantees delivery (high reliability), it's "connection" orientated. There are some downsides, but other alternatives are not available on most computers, routers and browsers.

A more important question is: what are you going to send over TCP? Generally, it's a good idea to use something that can be used in Flash and your server (see Remote Procedure Call for example).

"Push" messages are generally only a problem with HTTP connections, as it was designed to handle synchronous requests. However, in Flash you do not have this limitation.

Security can be added by "wrapping" a TCP connection: use SSL or TLS.

  • XML serialization (XML-RPC): easy to develop and maintain, moderate performance, maybe reliable.
  • RTMP (Real Time Messaging Protocol): native to Flash, great performance, great for realtime games, and can be tunneled over HTTP (to surpass any firewall/router).

See NetConnection class, and the Action Message Format.

The Adobe Integrated Runtime and Adobe Flash Player use AMF to communicate between an application and a remote server. AMF encodes remote procedure calls (RPC) into a compact binary representation that can be transferred over HTTP/HTTPS or the RTMP/RTMPS protocol. Objects and data values are serialized into this binary format, which increases performance, allowing applications to load data up to 10 times faster than with text-based formats such as XML or SOAP.

(from http://www.pyamf.org/)

稀香 2024-11-25 20:50:28

我们在 Flash 游戏中使用 WebORB 来进行服务器端和客户端的通信,但我不知道这是否足以满足您的要求。

抱歉,如果我错过了理解。

We use WebORB in our flash games for comunicating serverside and clientside but i don't know it is enough for your requirements.

Sorry if i miss understood.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文