如何使用 Flex 打开与服务器的连接? [英] How do I open a connection back to the server using Flex?
问题描述
我想使用 Flex 打开一个回服务器的连接,以便我可以将聊天消息流式传输到 Flex 前端.我该怎么做,Flex 是否对端口或子域强制执行任何同源限制?
I want to open a connection back to the server using Flex so I can stream chat messages to the Flex front-end. How do I do this and does Flex enforce any same-origin restrictions on ports or subdomains?
推荐答案
您必须使用消息服务器软件,然后使用 Flex 框架中的生产者和消费者类来发送和接收消息.
You'll have to use a messaging server software and then use the Producer and Consumer classes in the Flex framework to send and receive messages.
您需要什么取决于您运行的服务器.如果您使用的是 Java 堆栈,则可以使用 BlazeDS 和
What you need depends on what server you are running on. If you are on a Java stack, you can use BlazeDS and ActiveMQ.
如果您在不同域之间进行流式传输/消费,则需要设置 crossdomain 允许跨域通信的文件.
If you are streaming/consuming from and to different domains, you'll need to setup a crossdomain file that allows the inter-domain communication.
这篇关于如何使用 Flex 打开与服务器的连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!