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.
我正在尝试制作一个简单的聊天Web应用程序。简单的方法是每隔x秒使webapp(flash / ajax)查询服务器以查找新消息。
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.
有没有办法让web-app成为监听器,以便只要有客户端显示新消息,服务器就会联系它?我听说过有可能使用闪存。
Thanks
谢谢
2 个解决方案
#1
0
There are many different ways to achieve server initiated communication. Here you can read a good overview
有许多不同的方法来实现服务器启动的通信。在这里你可以阅读一个很好的概述
#2
0
Flash Sockets can be used to do what you describe:
Flash套接字可用于执行您所描述的操作:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/Socket.html
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
Flash打开与服务器的套接字连接。如果服务器有更新内容,则使用连接发送data.Flash重新获取数据并触发事件(socketData)以告知应用程序新数据可用
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.
如果您使用套接字,则Flash启动连接而不是服务器,因此NAT不是问题,但阻止这些连接的防火墙可以。
#1
0
There are many different ways to achieve server initiated communication. Here you can read a good overview
有许多不同的方法来实现服务器启动的通信。在这里你可以阅读一个很好的概述
#2
0
Flash Sockets can be used to do what you describe:
Flash套接字可用于执行您所描述的操作:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/Socket.html
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
Flash打开与服务器的套接字连接。如果服务器有更新内容,则使用连接发送data.Flash重新获取数据并触发事件(socketData)以告知应用程序新数据可用
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.
如果您使用套接字,则Flash启动连接而不是服务器,因此NAT不是问题,但阻止这些连接的防火墙可以。