开发者

Chat application where the client side is the listener rather than the webserver

开发者 https://www.devze.com 2023-03-18 00:11 出处:网络
I am trying to make a simple chat web application. The simple way is to make the webapp (flash/ajax) query the server every x seconds to find new messages.

I am trying to make a simple chat web application. The simple way is to make the webapp (flash/ajax) query the server every x seconds to find new messages.

Is there a way to make the web-app the listener so that the server will contact it whenever there are new messages to show on the client side? I've heard opinions开发者_运维知识库 that it is possible using flash.

Thanks


There are many different ways to achieve server initiated communication. Here you can read a good overview


Flash Sockets can be used to do what you describe:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/Socket.html

This works as follows:

Flash opens a socket connection to the server. If the server has something to update it uses the connection to send data.Flash recives the data and fires an event (socketData) to tell your application that new data is available

If you use sockets it's Flash starting the connection, not the server, for that reason NAT is not an issue, but firewalls blocking those connections can be.

0

精彩评论

暂无评论...
验证码 换一张
取 消