我正在尝试在FlashDevelop和FluorineFx中使用RTMP消息传递应用程序。我习惯于在FlexBuilder 3中使用NetConnection与一些hackery进行连接,但我正在绘制一个空白,让它与FlashDevelop一起使用。
我有一个FluorineFx网站,配有文件\ WEB-INF \ flex \ services-config
<?xml version="1.0" encoding="utf-8" ?>
<services-config>
<services>
<service-include file-path="remoting-config.xml" />
<service id="message-service" class="flex.messaging.services.MessageService" messageTypes="flex.messaging.messages.AsyncMessage">
<!-- DO NOT CHANGE <adapters> SECTION-->
<adapters>
<adapter-definition id="messagingAdapter" class="FluorineFx.Messaging.Services.Messaging.MessagingAdapter" default="true"/>
</adapters>
<destination id="chat">
<adapter ref="messagingAdapter"/>
<properties>
<network>
<session-timeout>0</session-timeout>
</network>
</properties>
<channels>
<channel ref="my-rtmp"/>
</channels>
</destination>
</service>
<!-- <service-include file-path="data-management-config.xml" /> -->
</services>
<!-- Custom authentication -->
<security>
</security>
<channels>
<channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
<endpoint uri="http://{server.name}:{server.port}/{context.root}/Gateway.aspx" class="flex.messaging.endpoints.AMFEndpoint"/>
<properties>
<!--<legacy-collection>true</legacy-collection> -->
</properties>
</channel-definition>
<channel-definition id="my-rtmp" class="mx.messaging.channels.RTMPChannel">
<endpoint uri="rtmp://{server.name}:1951" class="flex.messaging.endpoints.RTMPEndpoint"/>
</channel-definition>
</channels>
</services-config>
我的client.swf文件正在我网站上的目录\ apps \ chat中运行
在apps \ chat目录中,我有一个App.config文件:
<configuration>
<!-- Application object. Specify a fully qualified type name for your handler -->
<application-handler type="testfx.AppHandler"/>
<!-- Filename generator for streams. Specify a fully qualified type name to use a custom generator-->
<streamFilenameGenerator type="FluorineFx.Messaging.Rtmp.Stream.DefaultStreamFilenameGenerator"/>
<consumerService type="FluorineFx.Messaging.Rtmp.Stream.ConsumerService"/>
<providerService type="FluorineFx.Messaging.Rtmp.Stream.ProviderService"/>
<streamService type="FluorineFx.Messaging.Rtmp.Stream.StreamService"/>
<!-- Manages creation, retrieval and update of remote shared objects-->
<sharedObjectService type="FluorineFx.Messaging.Rtmp.SO.SharedObjectService">
<persistenceStore type="FluorineFx.Messaging.Rtmp.Persistence.FileStore"/>
</sharedObjectService>
<!--
<sharedObjectSecurityService type=""/>
-->
</configuration>
testfx.AppHandler类只有一个echo方法:
public class AppHandler : ApplicationAdapter
{
public string echo(string msg)
{
return "Echo: " + msg;
}
}
我有一个带有以下.swc库的FlashDevelop项目
main.as文件是:
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.events.NetStatusEvent;
import flash.net.NetConnection;
import flash.net.ObjectEncoding;
import mx.messaging.channels.*;
import mx.messaging.Consumer;
import mx.messaging.events.MessageEvent;
import mx.messaging.events.MessageFaultEvent;
import mx.messaging.Producer;
/**
* ...
* @author Nathan
*/
public class Main extends Sprite
{
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
var consumer:Consumer = new Consumer();
consumer.destination = "chat";
consumer.addEventListener(MessageEvent.MESSAGE, messageHandler);
consumer.addEventListener(MessageFaultEvent.FAULT, faultHandler);
consumer.subscribe();
var producer:Producer = new Producer();
producer.destination = "chat";
producer.addEventListener(MessageFaultEvent.FAULT, faultHandler);
producer.connect();
}
private function faultHandler(event:MessageFaultEvent):void
{
trace("fault");
}
private function messageHandler(event:MessageEvent):void
{
trace(event.message.body);
}
private function onNetStatus(event:NetStatusEvent):void
{
trace(event.info.code);
}
}
}
我运行时遇到的当前异常是:
[Fault] exception,information = [MessagingError message ='Destination 'chat'要么不存在,要么目的地没有频道 已定义(并且应用程序未定义任何默认通道。)']
答案 0 :(得分:0)
首先,如果更改services-config,则需要重新启动IIS或应用程序池。
其次,您是否检查了FluorineFX日志文件以查看是否存在任何错误(对于FluorineFX,DEBUG上的设置级别为+)。在日志文件中,您还应该看到添加的目标。看看聊天是否在其中。
第三,我会得到FluorineFX源代码并尝试从那里进行调试。了解一下源代码总是有用的。
FluorineFX的安装也附带了一些非常好的例子。检查出来并将它们与您的代码进行比较。也许通过这种方式你很快就会发现错误。
答案 1 :(得分:0)
我知道这已经晚了,但FluorineFX不接受任何其他目的地而不是“氟”。
<destination id="fluorine">