Web 应用程序中低延迟双向通信的 java/flash 替代方案?
我想设计具有低延迟的网络应用程序(例如游戏)。我认为 ajax 的标头会增加延迟。我真正想要的是一个连接永远不会中断的协议,并且客户端和服务器都可以立即相互推送数据。 (因此彗星并不是真正的选择,因为只有一侧有通信)。更好的办法是以二进制形式发送数据并对其进行压缩。
编辑:我想要 java/flash/silverlight 的替代品,因为我的平台是 ipad/iphone,它不支持 java/flash/silverlight
请不要推荐任何需要 java/flash/silverlight 的东西,谢谢
I would like to design webapps (eg. games) that have low latency. I presume that the header of ajax would add latency. What I really would like is a protocol where the connection is never broken, and both client and server can push data to each other immediately. (and thus comet isn't really a choice, since there is communication only one side). Better would be to send data as binary and compress it.
Edit: I want an alternative to java/flash/silverlight because my platform is ipad/iphone, which DOES NOT support java/flash/silverlight
Please do not recommend any thing that is/needs java/flash/silverlight, thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
根据您的时间表和施加用户要求的能力,您可以使用 WebSockets。有关浏览器支持的信息,请参阅链接文本。
Depending on your timeline and ability to impose user requirements, you could use WebSockets. See link text for info about browser support.
您可能正在寻找的内容可以使用 Actionscript 中的 Flash 和 Socket 编程最轻松地完成。这将允许您保持与服务器的持续连接(您还必须编写服务器,我建议使用 Haxe),并为信息交换提供相当低的延迟。
请记住,此级别的通信将具有挑战性,因为您将需要设计自己的协议来打包和解包发送的数据。
What you are probably looking for can most easily be accomplished using Flash and Socket programming in Actionscript. That will allow you to maintain a constant connection to a server (which you would also have to write, I would recommend Haxe for that), and provide a decently low latency for exchanging information.
Keep in mind though that communicating at this level will be challenging as you will be required to design your own protocol for packing and unpacking the data you send.
Flash、Java 和 Silverlight 都支持套接字。这将为您提供一个不带 http 标头的连续连接,允许数据在任一方向发送。
缺点是,它不能在所有网络环境中工作。
Flash, Java, and Silverlight all support sockets. This will give you a continuous connection w/o http headers that can allow data to be sent in either direction.
The downside is, it won't work in all network environments.
看一下 BlazeDS,它使用 AMF 作为两者之间的序列化协议。 BlazeDS 是一个 Java 服务器平台,用于使用 AMF 序列化到 Flex/Flash 应用程序在 Spring 中构建应用程序。 AMF 是一种占用空间非常小的二进制协议。网上流传着一个示例,比较了 Flash 应用程序中的 JSON、XML 和 AMF。
http://www.jamesward.com/census/
http://insideria.com/2008/09/amf-vs-json-vs-xml.html
Look at BlazeDS which uses AMF as a serialization protocol between the two. BlazeDS is a Java server platform for building applications in Spring using AMF serialization to Flex/Flash applications. AMF is a binary protocol that has a very small footprint. There is an example floating around the net comparing JSON, XML, and AMF in flash applications.
http://www.jamesward.com/census/
http://insideria.com/2008/09/amf-vs-json-vs-xml.html