|
|
 Rank: Newbie Coder Groups: Member
Joined: 4/22/2010 Posts: 12 Points: 36 Location: Netherlands
|
Hi, Iam running the ServerPush example and my Flex client side code is not receiving the server side generated messages. I have debugged the server side and can see that it generates random messages. I have generated my client side flex code using weborb code generation for Flex 3. My setup are two seperate projects. The first is the java backend running weborb and my ServerPush code, the second and last is a separate Flex frontend running the client side flex code. The generated code does not work out of the box. It cannot find the correct url to connect to (it gives me http://weborb.wo, which should be http://localhost:8080/MyContext/weborb.wo) To atleast get it to connect to the server side code I have added the following code to the constructor of the generated code: Code: public function ServerPush( model:ServerPushModel = null ) { remoteObject = new RemoteObject(); remoteObject.source = "weborb.examples.messageserver.ServerPush"; var _endPoint:String = "http://localhost:8080/WebOrbPOC/weborb.wo"; var CHANNEL:String = "weborb-rtmp"; var cs:ChannelSet = new ChannelSet(); var myAMF:Channel = new AMFChannel(CHANNEL, _endPoint); cs.addChannel(myAMF); remoteObject.channelSet = cs; remoteObject.destination = "GenericDestination"; remoteObject.startListening.addEventListener("result",startListeningHandler); remoteObject.addEventListener("fault", onFault); if( model == null ) model = new ServerPushModel(); this.model = model;
}
After adding this code, the client can connect to the serverside ServerPush and I see a message being generated. But nothing else. I have added breakpoints to my resulthandler, but nothing happens. Iam using all default config files, I have added in my flex compiler settings the weborb-config, but to no avail Anyone any suggestions to solve this problem ? how do I connect to the RTMP channel correctly? http://nl.linkedin.com/in/marcdekwant
|
|
 Rank: Administration Groups: Administration
Joined: 8/21/2006 Posts: 1,607 Points: 4,082 Location: Frisco, TX
|
Can you describe in greater details what exactly you're trying to accomplish? The generated code will use the default endpoint URL, which is a relative URL - "weborb.wo". That means if your Flex application is loaded from the web server, it will use the relative URL to communicate with the server. For example, if your Flex app is loaded from http://localhost:8080/foobar/MyFlexApp.html, it will use http://localhost:8080/foobar/weborb.wo as the remoting URL. What I suspect you have in your case is your Flex application was loaded from the file system, so the URL in the browser started with "file://...". Obviously that will not work with the relative URLs. The sample code you posted does just a remoting invocation. I am not sure how you can get Server Push with that. Mark
Mark Piller Midnight Coders, Inc. twitter: midnightcoderblog: blog.themidnightcoders.comwebsite: www.themidnightcoders.com
|
|
 Rank: Newbie Coder Groups: Member
Joined: 4/22/2010 Posts: 12 Points: 36 Location: Netherlands
|
Hi, Thank you for the reply. That is correct, I am loading the flex app from file system. That is why Iam providing the complete url to the server. You are right to point out that this is not ServerPush. But that is exactly my question. I have no clue how to get it done with weborb. There is some documentation for producers and consumers, but that does not seem to work when you load your app from filesystem. Can you point me to a flex example with rtmp using the Serverpush serverside example code? Kind regards, Marc http://nl.linkedin.com/in/marcdekwant
|
|
 Rank: Administration Groups: Administration
Joined: 8/21/2006 Posts: 1,607 Points: 4,082 Location: Frisco, TX
|
|
|
 Rank: Newbie Coder Groups: Member
Joined: 4/22/2010 Posts: 12 Points: 36 Location: Netherlands
|
Thank you very much. I will go to work with this. kind regards, Marc File Attachment(s):
WebOrbPOCJava.zip (3,641kb) downloaded 38 time(s).
WebOrbPOCFlex.zip (1,349kb) downloaded 36 time(s).
classes.zip (25kb) downloaded 29 time(s).
http://nl.linkedin.com/in/marcdekwant
|
|
 Rank: Newbie Coder Groups: Member
Joined: 4/22/2010 Posts: 12 Points: 36 Location: Netherlands
|
Hi, I have tried the example, but I can not get it to work. I always get "Unable to connect to WebORB". Furthermore, the server-side part is never invoked. When I put a breakpoint in the public boolean appStart(IScope app) method, it never gets there, although I can see that the code is present in my runtime environment. Kind regards, Marc http://nl.linkedin.com/in/marcdekwant
|
|
 Rank: Newbie Coder Groups: Member
Joined: 4/22/2010 Posts: 12 Points: 36 Location: Netherlands
|
Hi, I have added 2 zip files containing both my projects. Can you tell me what Iam doing wrong? the zip with java is a Maven 2 project containing server side code + weborb in one. This project runs weborb and uses my custom code to push messages. The flex is your example code in a flex 3 project. I hope we can get it to work. Kind regards, Marc http://nl.linkedin.com/in/marcdekwant
|
|
 Rank: Administration Groups: Administration
Joined: 8/21/2006 Posts: 1,607 Points: 4,082 Location: Frisco, TX
|
I do not see any attachments or links where I could download your files. Mark
Mark Piller Midnight Coders, Inc. twitter: midnightcoderblog: blog.themidnightcoders.comwebsite: www.themidnightcoders.com
|
|
 Rank: Administration Groups: Administration
Joined: 8/21/2006 Posts: 1,607 Points: 4,082 Location: Frisco, TX
|
There is a problem in your datapush-service-web.xml. The ID of the second bean should be "datapush.scope", you currently have it as "messservice.scope". Mark
Mark Piller Midnight Coders, Inc. twitter: midnightcoderblog: blog.themidnightcoders.comwebsite: www.themidnightcoders.com
|
|
 Rank: Newbie Coder Groups: Member
Joined: 4/22/2010 Posts: 12 Points: 36 Location: Netherlands
|
hi, Thank you for your analysis of my code. I will correct this when I am at work. Kind regards, Marc ps. did you have any other problems with my code? http://nl.linkedin.com/in/marcdekwant
|
|
Rank: Newbie Coder Groups: Member
Joined: 8/4/2010 Posts: 14 Points: 36
|
Hello, I tried the example nut I get an error at the foillowing line : Iterator connectionsIterator = this.scope.getConnections();
Type mismatch: cannot convert from Collection> to Iterator
I am a Flex Developer(DigitalMedia MSc. Student) and I like to use WebOrb for the following: * RTMP Radio Station with multiple channels (genres) (* Audio Playback on demand) * Chat (eventually with video) To archive those goals I need some starting help, some examples , documentation anything what might help me.
|
|
 Rank: Administration Groups: Administration
Joined: 8/21/2006 Posts: 1,607 Points: 4,082 Location: Frisco, TX
|
Any chance you could post here the full stack trace you're getting? Thanks, Mark
Mark Piller Midnight Coders, Inc. twitter: midnightcoderblog: blog.themidnightcoders.comwebsite: www.themidnightcoders.com
|
|
 Rank: Newbie Coder Groups: Member
Joined: 4/22/2010 Posts: 12 Points: 36 Location: Netherlands
|
Hi here is an example from my working application Code: import java.util.Iterator; import java.util.Timer; import java.util.TimerTask;
import org.red5.server.api.IConnection; import org.red5.server.api.IScope; import org.red5.server.api.service.IServiceCapableConnection;
import weborb.messaging.WebORBApplication;
public class PushServiceMockImpl extends WebORBApplication { private Timer pushTimer; public boolean appStart(IScope app) { boolean started = super.appStart(app); if (started) { pushTimer = new Timer(true); pushTimer.scheduleAtFixedRate(new DataPushTask(), 0, 15000); } return started; } public void pushAlertsToClients(String message) { Object[] args = new Object[] { message }; Iterator connectionsIterator = this.scope.getConnections(); while (connectionsIterator.hasNext()) { IConnection connection = connectionsIterator.next(); if (connection instanceof IServiceCapableConnection) { ((IServiceCapableConnection) connection).invoke("myPush",args); } } } class DataPushTask extends TimerTask { @Override public void run() { pushAlertsToClients( "push message" ); } }
}
You also need a configuration for red5 for this service. Unfortunately I cant seem to get it to show up in a post. But there are examples in de weborb packages. and not to forget an important piece of code you must add to your running weborb/red5 instance You must add a service config file reference (see above) in the beanrefcontext file. This is not a complete example, but sould get you on your way to a running setup. Furthermore the Error you had in Java: try Iterator it = yourcollection.iterator(); Marc http://nl.linkedin.com/in/marcdekwant
|
|
Rank: Newbie Coder Groups: Member
Joined: 8/4/2010 Posts: 14 Points: 36
|
Mark Piller wrote:Any chance you could post here the full stack trace you're getting?
Thanks, Mark pardon, I don't understand, Eclipse is just displaying that error above.
|
|
 Rank: Administration Groups: Administration
Joined: 8/21/2006 Posts: 1,607 Points: 4,082 Location: Frisco, TX
|
Try changing Iterator to Collection and it should compile then. Mark
Mark Piller Midnight Coders, Inc. twitter: midnightcoderblog: blog.themidnightcoders.comwebsite: www.themidnightcoders.com
|
|
Rank: Newbie Coder Groups: Member
Joined: 1/26/2012 Posts: 16 Points: 42
|
Changing from Iterator to Collection didn't work for me. Is there an updated example of RTMP Data Push from Java to Flex somewhere? The code here doesn't compile...
|
|
Rank: Newbie Coder Groups: Member
Joined: 1/26/2012 Posts: 16 Points: 42
|
It looks like I ran across the updated source in another form from the post here. This seems to be compiling fine: Collection > connections = scope.getConnections(); Object[] args = new Object[] { "Server time is " + System.currentTimeMillis() };
for( Set connectionSet : connections ) for( IConnection connection : connectionSet ) if( connection instanceof IServiceCapableConnection ) ((IServiceCapableConnection) connection).invoke( "setLogText", args );
|
|
|
Guest |