Finally, after two days of hard work and lots of hick ups , I was able to implement real time messaging between C# and Flex.
Let's get into code real fast as I know it must have been very frustrating trying to get it done (without any documentation from Fluorine or any help, I was unable to find it on google too, surprising).
The example I show here is same as one of the samples provided by Fluorine however, I think if you are able to run this sample by your own code you can develop an application that is able to send messages as your requirements are. The example I used is of Date feed. We will send send date and time from the server side (C#) to the flex RTMP client and display it here.
The C# code is as below. Create an empty solution add a Fluorine class library and a Fluorine Website to the solution. In the class library add a class "DateFeedService" as below.
And the Flex side code is as below.
Now comes the most important (and undocumented) part that will instruct the .NET side to start a RTMP server and listen on a particular port, this is the configuration part.
Since we are using Remoting and Messaging both in the same application we will have to configure both for the application to work.
Moreover, configuration is required in the Flex and .NET side as well.
The configuration for the flex side is as below:
Configuration for the C# side is as below. These files must be located in the Fluorine website we created earlier within the WEB-INF/flex folder.
Three files are necessary.
1. services-config.xml
2. remoting-config.xml
3. messaging-config.xml
The first configuration file sets up channels for Remoting and messaging and instructs to load the remaining two config files for the services section.
The other two files deal with the configuration of the messaging and remoting adapters. The messaging config file configures the application to start RTMP server on a particular port and listen for incoming requests from subscribers.
Hope the above example help you to send real time messages to your flex application from C#.
Comments ?
Subscribe to:
Post Comments (Atom)
This is a wonderful post Gaurav, I have tested it; first I got a build error stating that the class "mx.messaging.channels.RTMPChannel" can not be found, then after some searching it turned out to be that there is a missing SWC file named fds.swc that can be found in LCDS 3. After obtaining the fds.swc from the LCDS 3, the Flex builds successfully but on clicking the "Start" button I get this error:
ReplyDelete[RPC Fault faultString="Failed to locate the requested type *" faultCode="Server.Processing" faultDetail="null"]
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:220]
at mx.rpc::Responder/fault()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:53]
at mx.rpc::AsyncRequest/fault()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:103]
at NetConnectionMessageResponder/statusHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\channels\NetConnectionChannel.as:569]
at mx.messaging::MessageResponder/status()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\MessageResponder.as:222]
But I can not find any solution for that, any ideas?
Hey can u post the full code of our application in file....
ReplyDeletealso write about how to configure these config files as i m new to flex...
thankx & regards
jolly
Is it possible to create a rtmp server app without having to add a flourine website to the solution?
ReplyDeletehttp://riamagic.blogspot.com/2010/12/flex-and-net-connectivity-using.html
ReplyDeleteModified the same example
May help you