AS3实时更新和推送数据 [英] Realtime update and Push Data in AS3

查看:28
本文介绍了AS3实时更新和推送数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对我的 Flash 应用程序进行实时更新.而不是让它每 30 秒刷新一次,我更喜欢推送技术.在 Actionscript 3 中推送数据的最佳方式是什么?

i want to make a real-time update for my flash application. Instead on making it refresh each 30secs, i would prefer the push technology. What is the best way to push data in Actionscript 3 ?

推荐答案

实现实时更新有两种流行的选项:套接字和 RTMP.每种方法都有优点和缺点,但主要的决定因素通常是您的服务器基础架构.

There are two popular options for implementing real-time updates: sockets and RTMP. There are advantages and disadvantages to each, but the primary deciding factor is usually your server infrastructure.

套接字

套接字提供最低级别的功能.这意味着您需要在客户端和服务器上的代码中实现一个协议.然而,这种方法的最大优点是它可以用于任何支持 TCP/IP 套接字的服务器端技术.您可以以您喜欢的任何格式发送数据,但最有效的是使用 ActionScript 消息格式 (AMF) 以二进制格式传输数据.

Sockets provide the lowest-level functionality. This means you will need to implement a protocol in code on the client and on the server. However, the biggest advantage of this approach is that the it can be made to work any server-side technology that supports TCP/IP sockets. You can send data in whichever format you like, but the most efficient would be to use ActionScript Message Format (AMF) to transfer the data in binary format.

RTMP

实时媒体协议是由 Adob​​e 开发并由Flash播放器.使用 RTMP 需要一个可以支持该协议的特定服务器.有专有解决方案,也有免费解决方案.使用 RTMP 的优点是大部分协议已经实现,共享数据可以像设置共享对象的值一样简单 - 协议在幕后处理数据传输.RTMP 使用 AMF 对消息进行编码,因此带宽使用效率很高.该协议还支持 HTTP 上的隧道",这意味着当 RTMP 连接不可能时,它会求助于 HTTP 上的轮询.

Real-Time Media Protocol is a protocol developed by Adobe and implemented natively by the Flash Player. Using RTMP would require a specific server which can support the protocol. There are proprietary solutions, as well as free ones. The advantage of using RTMP is that much of the protocol is already implemented, and sharing data can be as simple as setting the value of a shared object - with the protocol handling the data transfer behind the scenes. RTMP encodes messages using AMF so bandwidth usage is efficient. The protocol also supports "tunneling" over HTTP, which means it resorts to polling over HTTP when an RTMP connection is not possible.

以下是一些用于实现 RTMP 和/或 AMF 的服务器端解决方案:

Here are some server-side solutions for implementing RTMP and/or AMF:

  1. FluorineFX (.Net)
  2. WebORB(.Net、Java、PHP)
  3. Red5(Java)
  4. Adobe Flash 媒体服务器(Java)
  1. FluorineFX (.Net)
  2. WebORB (.Net, Java, PHP)
  3. Red5 (Java)
  4. Adobe Flash Media Server (Java)

维基百科上的这个条目更详细地描述了 RTMP 协议和可用的服务器.

This entry on Wikipedia describes the RTMP protocol and available servers in more detail.

这篇关于AS3实时更新和推送数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆