Is this what you ment ?
public class Application extends ApplicationAdapter {
................
................
public boolean appStart(IScope app){
this.initApplication();
String id = addScheduledJob(10000, new FannarchyJob(this));
return true;
}
................
................
}
public class FannarchyJob implements IScheduledJob {
private Application appref;
// Constructor to initialize balance
public FannarchyJob(Application ref){
appref = ref;
}
// Overloaded constructor for empty balance
public FannarchyJob(){
}
public void execute(ISchedulingService service) {
// Do something
this.ServerMessage(0);
// Application.callreturn = "test"+count;
}
public void ServerMessage(int dest){
Set<IClient> Clients = appref.getClients();
Iterator<IClient> Client = Clients.iterator();
String test[] = {"test","test2sssssssssss"};
while(Client.hasNext()) {
IClient theClient = Client.next();
Set<IConnection> Connections =
theClient.getConnections();
Iterator<IConnection> Connection =
Connections.iterator();
while(Connection.hasNext()) {
IConnection theConnection = Connection.next();
if (theConnection instanceof
IServiceCapableConnection){
IServiceCapableConnection sc =
(IServiceCapableConnection) theConnection;
sc.invoke("the_method", new Object[]{"test",
test});
}
}
}
}
}
__________________
Morten Hundevad
_____
Fra: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] På vegne af
joseph wamicha
Sendt: 6. februar 2007 06:36
Til: [email protected]
Emne: [Red5] few questions,IScheduledJob / Set<..> /
IServiceCapableConnection.invoke()
>1: how would i inside the FannarchyJob access data inside the main app ?
Declare classes with constructors inside your WEB-INF directory. Then call
the classes and it's methods as you would in a normal JAVA application. I
haven't tried this yet but I'm suspecting it will work. Also, to access
resources created from within the main application, extend
ApplicationAdapter within FanarchyJob.
>2: how would i send a message ( sc.invoke("the_method", new
Object[]{"message"}); ) to all user's conected ( from inside the
FannarchyJob evry 30 sec) and/or to a special user ?( like user's in a
special room )
Joachim's migration guide shows you how to create a 30sec job schedule.
Though I haven't tried it, probably extend ApplicationAdapter in
FanarchyJob, then get all connected clients and send them their message.
>3: is there a equal to clientObj.referrer in red5 ? ( so i can make sure
the
swf is used from my site )?
mmhh, I don't know. That's a good question!!! The RTMP message must come
with this... I really wonder if red5 can allow you to poll such data!
>4: How would i used the output off app.getClients(); and
theClient.getConnections(); i am unfalilat with Set<IClient> and
Set<IConnection> dont understand how to use ?
Iterate through the returned Set:
ie probably try this (again I haven't tested):
Iterator<String> it = thisScope.getClients().iterator();
while(it.hasnext())
{
//you can now get your clients using normal iterator methods...
}
Do the same for getConnections.
--
C is forever.
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.25/669 - Release Date: 04-02-2007
21:58
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.25/669 - Release Date: 04-02-2007
21:58
_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org