[Red5] ping_interval and max_inactivity settings
Christopher Walzl
cwalzl at gmail.com
Mon Nov 10 10:31:14 PST 2008
There may be other ways to accomplish this, but for what I was
suggesting, you'd have to override the ApplicationAdapter method. To
Override it, you'll have to make sure the method's signature that you
write matches the ApplicationAdapter's signature exactly. For example:
public void appDisconnect(IConnection arg0)
{
super.appDisconnect(arg0);
this.destroySession(Red5.getConnectionLocal());
}
private void destroySession(IConnection arg0)
{
super.appDisconnect(arg0);
// do your cleanup here
}
I have a private method that I wrote called
"destroySession(IConnection connection)" that I call when the
appDisconnect() method is called. There are other methods you may
need to override as well - for example:
public void appLeave(IClient arg0, IScope arg1)
{
super.appLeave(arg0, arg1);
this.destroySession(Red5.getConnectionLocal());
}
public void roomStop(IScope arg0)
{
super.roomStop(arg0);
this.destroySession(Red5.getConnectionLocal());
}
public void roomDisconnect(IConnection arg0)
{
super.roomDisconnect(arg0);
this.destroySession(Red5.getConnectionLocal());
}
public void roomLeave(IClient arg0, IScope arg1)
{
super.roomLeave(arg0, arg1);
this.destroySession(Red5.getConnectionLocal());
}
As I'm pasting some of the code I've written, I'm now realizing that
there is a IConnection passed into the methods you'll be overriding.
You may be able to use that IConnection instance rather than calling
Red5.getConnectionLocal(). I'm not sure if I ran into trouble doing
it that way before, or if I just overlooked it.
Good luck!
Chris Walzl
cwalzl at gmail.com
(972) 974-6728
Sent from my MacBook Pro
On Nov 10, 2008, at 11:40 AM, Gaby Vanhegan wrote:
>
> On 10 Nov 2008, at 11:22, Christopher Walzl wrote:
>
>> Yeah, the server will receive an ApplicationAdapter.appDisconnect()
>> event if that happens. I just implemented something like that
>> recently. You can call Red5.getLocalConnection() in the
>> appDisconnect() thread to determine which connection was dropped.
>
>
> Would this work?:
>
> public void appDisconnet ( IConnection conn, Object[] params ) {
> // Do whatever we need to delete this client from games/chats/etc
> }
>
> Or do I explicitly need to do:
>
> public void appDisconnet ( ) {
> IConnection conn = Red5.getLocalConnection();
> // Do whatever we need to delete this client from games/chats/etc
> }
>
> G.
>
> --
> Uganda Maximum - Enemy of the English Thrust
> http://www.playr.co.uk/
>
>
> _______________________________________________
> Red5 mailing list
> Red5 at osflash.org
> http://osflash.org/mailman/listinfo/red5_osflash.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/red5_osflash.org/attachments/20081110/4dfe5838/attachment-0001.html>
More information about the Red5
mailing list