« Return to Thread: Question about IServiceCapableConnection invoke

Re: Question about IServiceCapableConnection invoke

by Rhys Causey-2 :: Rate this Message:

Reply to Author | View in Thread

Thanks Tyler,

I'm trying this, but when I try to get the local connection via Red5.getConnectionLocal() in the new thread, it returns null. Also, ServiceUtils.invokeOnConnection doesn't work (presumably for the same reason). How can I access the local connection from within a new thread? 

Thanks!
Rhys

On 8-Jul-09, at 6:41 PM, Tyler Kocheran wrote:

Try forcing the conversion to happen AFTER the service call is finished. There may be limitations in RTMP preventing calls from the server to the client from happening while calls from the client to the server are happening over one connection. Also, if your method hangs too long, Red5 will sometimes disconnect the client (after a minute or so). Try something like this and let me know what you get:

//Client
connection.client = { onProgress: onProgress };
function onProgress(percent:Number):void {
     trace(percent + "% done.");
}

// I know it's sloppy (WALTER), but it's just to see if it works :)
connection.call("convertMedia", new Responder(onSuccess, onFault), currentFileName);

//Server
public void convertMedia(String currentFileName) {
      new Thread(new Runnable(){ public void run() { doConversion(); } }).start();
}

The point here is to make your conversion task happen asynchronously, which is definitely the best thing to do anyway :)
I would recommend using an Executor, perhaps Executors.newFixedThreadPool(16) or something of the sort. That way you can run tons of asynchronous tasks concurrently, making the best use of your machine.

On Wed, Jul 8, 2009 at 3:15 PM, Rhys Causey <rhys@...> wrote:
Hmm... where could it be blocking? I also tried using a remote shared object and get the same behaviour. I set a break point in my flash client, but can't really tell anything there. It seems to make the call() and then just idle while the conversion is taking place, even though Red5 is reporting progress through the log. 

This is how I'm calling the method from my client: 
connection.call("convertMedia", new Responder(onSuccess, onFault), currentFilename);
The client receives all of the notifications right before onSuccess is called. The order of all of the notifications is correct, it's just not receiving them at the right time.

Rhys

On 8-Jul-09, at 4:32 PM, Tyler Kocheran wrote:

It should send them at the appropriate times, but it seems that something you're doing is causing the thread to block. Try setting breakpoints and check it out.

On Wed, Jul 8, 2009 at 1:22 PM, Rhys Causey <rhys@...> wrote:
Hi,

I'm using the IServiceCapableConnection invoke method to report progress on a file conversion back to the flash client. The client is receiving the messages fine, but they all come in one large chunk after everything's done. I'm logging the invocations in my Red5 app, and they're showing up in the log at the appropriate times, but they only reach the client after the conversion is complete. Is there a way to force it to send the messages right away?

Thanks!

_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org



--
And do this, knowing the time, that now it is high time to awake out of sleep;
for now our salvation is nearer than when we first believed.
_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org


_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org




--
And do this, knowing the time, that now it is high time to awake out of sleep;
for now our salvation is nearer than when we first believed.
_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org


_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org

 « Return to Thread: Question about IServiceCapableConnection invoke