ActionScript Socket vs WebSocket

2019-08-06 04:04发布

问题:

I'm working on a Flash based networked game. I have to choose between ActionScript sockets and WebSockets (or more specifically socket.io). I'm wondering which is the better choice. I'm leaning toward ActionScript sockets since it (should) will be standard across all browsers. With socket.io, WebSockets can only be used in HTML5 and it can even result to polling for some older browsers which is a big issue.

Would you guys say that ActionScript sockets is the better choice?

Thank you very much!

回答1:

The world is moving towards WebSockets (and HTML5, in general).

Flash is becoming more challenging than ever, given that many tablets, smartphones (and even IE10 in Metro style) don't support plugins. Adobe announced that they will stop developing Flash for mobile browsers. Flash may be OK for the purposes of your application, but it's pretty clear that at this point HTML5 is way more "future proof" than Flash.

As for the browser support for HTML5 and specifically WebSockets: some of the WebSocket servers provide very clever emulation techniques that on one hand allow the developer to code against the WebSocket APIs, on the other hand automatically select the best transport layer under the given circumstances (browser, platform, proxies, routers, and other intermediaries). For example, the Kaazing WebSocket Gateway [disclosure: I work for Kaazing] does emulation exceptionally well (check out this blog post if interested in WebSocket emulation using older browsers, including IE6).

And one more thing: if Flash is a technology you're familiar with and need to use for development, Kaazing has WebSocket APIs for Flash, Flex, Air (as well as Java, .Net, and obviously JavaScript) as well.

Overall, I'd definitely go the WebSockets route today.