简体   繁体   English

如何在FlashDevelop AS3项目中使用FluorineFx配置RTMP通道?

[英]How to configure an RTMP channel with FluorineFx in a FlashDevelop AS3 Project?

I am trying to get a RTMP messaging application working in FlashDevelop and FluorineFx . 我试图在FlashDevelopFluorineFx中使用RTMP消息传递应用程序。 I am used to connecting with a NetConnection in FlexBuilder 3 with some hackery but I am drawing a blank getting this to work with FlashDevelop. 我曾经在FlexBuilder 3中使用一些黑客技术来连接NetConnection,但是我正在画一个空白,使它可以与FlashDevelop一起使用。

I have a FluorineFx website with a configuration file \\WEB-INF\\flex\\services-config 我有一个带有配置文件\\ WEB-INF \\ flex \\ services-config的FluorineFx网站

<?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>

My client.swf file is running in a directory \\apps\\chat on my website 我的client.swf文件正在我的网站上的\\ apps \\ chat目录中运行

Within the apps\\chat directory I have an App.config file: 在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>

The testfx.AppHandler class only has an echo method: testfx.AppHandler类仅具有echo方法:

   public class AppHandler : ApplicationAdapter
    {
        public string echo(string msg)
        {
            return "Echo: " + msg;
        }
    }

I have a FlashDevelop project with the following .swc libraries 我有一个带有以下.swc库的FlashDevelop项目

  • framework.swc framework.swc
  • rpc.swc rpc文件
  • rpc_rb.swc rpc_rb.swc

And the main.as file is: 而且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);
        }

    }

}

The current exception I am getting when I run this is: 运行此命令时遇到的当前异常是:

[Fault] exception, information=[MessagingError message='Destination 'chat' either does not exist or the destination has no channels defined (and the application does not define any default channels.)'] [Fault]异常,信息= [MessagingError message ='目的地'聊天'不存在,或者目标未定义渠道(并且应用程序未定义任何默认渠道。)']

我知道这很晚,但是FluorineFX除了“氟”以外不接受其他任何目的地。

<destination id="fluorine">

First of all, if you change the services-config, you'll need to restart IIS or application pool. 首先,如果更改services-config,则需要重新启动IIS或应用程序池。

Secondly, have you checked the FluorineFX log file to see if there are any errors (+ set level on DEBUG for FluorineFX). 其次,您是否检查了FluorineFX日志文件以查看是否存在任何错误(+在DEBUG上为FluorineFX设置的级别)。 In the log file you should also see the destinations which are added. 在日志文件中,您还应该看到已添加的目标。 See if Chat is among them. 查看聊天是否在其中。

Thirdly I would get the FluorineFX source code and try to debug it from there. 第三,我将获得FluorineFX源代码并尝试从那里调试它。 It's always useful to get to know the source code a little bit. 稍微了解源代码总是很有用的。

Some very good examples are also shipped with the installation of FluorineFX. FluorineFX的安装还附带了一些非常好的示例。 Check them out and compare them to your code. 签出它们并将它们与您的代码进行比较。 Maybe this way you'll quickly find what's wrong. 也许通过这种方式,您会很快发现问题所在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM