ActionScript和伺服器端通訊的基礎協議

來源:互聯網
上載者:User

因為項目需要,在技術選型的時候,需要在Flex 用戶端和 PHP伺服器端選擇一個基礎協議。

目前有集中選擇:

1.AMFPHP(http://www.amfphp.org/)

AMF是Action Message Format協議的簡稱,AMF協議是Adobe公司自己的協議,主要用於資料互動和遠端程序呼叫,在功能上相當於WebService,但是AMF與WebService中的XML不同的是AMF是位元據,而XML是文本資料,AMF的傳輸效率比XML高。AMF使用HTTP方式傳輸,目前主要是用於ActionScript中,即實現Flex和Server之間的通訊。

2.JSON(http://www.json.org/json-zh.html)

JSON(JavaScript Object Notation) 是一種輕量級的資料交換格式。易於人閱讀和編寫。同時也易於機器解析和產生。它基於JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999的一個子集。 JSON採用完全獨立於語言的文字格式設定,但是也使用了類似於C語言家族的習慣(包括C, C++, C#, Java, JavaScript, Perl, Python等)。這些特性使JSON成為理想的資料交換語言。

這是其他人的一個效能評測報告,考慮到AMFPHP是二進位,並且是官方支援的,所以還是選擇AMFPHP好了

In the tests, I use the AMFPHP library, which you'll need for the AMFPHP test. I use the Zend Framework for the JSON library, converting my PHP Array to JSON. JSON is handled in Flex with the use of the JSON library. The XML test is the simplest of all, simply printing out the XML without having to load any other library or files.

Here's the data (times are in ms):

# of data

XML

AMFPHP

JSON

5000

1903

2033

2814

10000

3625

3495

4747

15000

4326

4867

6830

20000

5939

6550

9094

25000

6570

7942

11838

30000

8473

10335

14512

35000

9594

12389

17716

40000

10885

14651

20480

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.