Query server status from outside

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

Query server status from outside

by Thomas-128 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

After presenting my website, it appeared that my application doesn't
inform the users about visiconferences being currently broadcasted or
not, so people just see a blank page if nobody is in the room, and it
feels like my app is not working properly. Therefore I'd like my Ruby
on Rails application to be able to query red5 about a stream being
broadcasted or not.

I would simply issue a query using http like: "is user_id
broadcasting?" and red5 would simply answer "true/false". How do do
that?

--
VOD & visioconference - http://www.digiprof.tv

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

Re: Query server status from outside

by Dominick Accattato-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

create a servlet that can be called from your application.  The servlet just needs to grab the applicationContext which can then be used to resolve scopes.  Once you've got a listing of your scopes, you can grab the connections/clients or whatever you need.

On Wed, Oct 28, 2009 at 3:35 PM, Thomas <iamkenzo@...> wrote:
Hi,

After presenting my website, it appeared that my application doesn't
inform the users about visiconferences being currently broadcasted or
not, so people just see a blank page if nobody is in the room, and it
feels like my app is not working properly. Therefore I'd like my Ruby
on Rails application to be able to query red5 about a stream being
broadcasted or not.

I would simply issue a query using http like: "is user_id
broadcasting?" and red5 would simply answer "true/false". How do do
that?

--
VOD & visioconference - http://www.digiprof.tv

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


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

Re: Query server status from outside

by Dominick Accattato-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

btw, we have listed several ways on how to get the applicationContext up on the trac.red5.org site under documentation.

On Thu, Oct 29, 2009 at 9:06 AM, Dominick Accattato <dominick@...> wrote:
create a servlet that can be called from your application.  The servlet just needs to grab the applicationContext which can then be used to resolve scopes.  Once you've got a listing of your scopes, you can grab the connections/clients or whatever you need.


On Wed, Oct 28, 2009 at 3:35 PM, Thomas <iamkenzo@...> wrote:
Hi,

After presenting my website, it appeared that my application doesn't
inform the users about visiconferences being currently broadcasted or
not, so people just see a blank page if nobody is in the room, and it
feels like my app is not working properly. Therefore I'd like my Ruby
on Rails application to be able to query red5 about a stream being
broadcasted or not.

I would simply issue a query using http like: "is user_id
broadcasting?" and red5 would simply answer "true/false". How do do
that?

--
VOD & visioconference - http://www.digiprof.tv

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



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

Re: Query server status from outside

by Thomas-128 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I tried following the example: http://red5.org/wiki/Examples/FileUploadServlet

But I can manage to correctly setup my servlet. The amount of xml
garbage required by tomcat is just daunting me.

Does anyone have a code example for a red5 app with a simple
HelloWorld servlet? I'm specially interested in the configuration
file.


Thanks,


--
VOD & visioconference - http://www.digiprof.tv

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

Re: Query server status from outside

by Thomas-128 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Argh I don't what kind of url to type in my bowser to test if the
servlet is reached. By the way why is 8080 not running? Is that
normal?


--
VOD & visioconference - http://www.digiprof.tv

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

Re: Query server status from outside

by Thomas-128 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Cool I got it working! I had to add the application name in the url.
Now I need to be able to hook myself to red5 and fetch the list of
currently published streams.


--
VOD & visioconference - http://www.digiprof.tv

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

Re: Query server status from outside

by Thomas-128 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Oct 29, 2009 at 2:07 PM, Dominick Accattato <dominick@...> wrote:
> btw, we have listed several ways on how to get the applicationContext up on
> the trac.red5.org site under documentation.

The examples provided are unclear and thus unusable. I tried compiling
the stuff posted and it didn't work. I added an I to the class names
and it did compile, but "now what?". ApplicationContext#getBean does
not exist although it's posted as such on the samples' page.

My goal is to get the list of all currently published streams. How to do that?

--
VOD & visioconference - http://www.digiprof.tv

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

Re: Query server status from outside

by Mondain :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If i have time later i'll post how to get the stream names, but for now I would like to point out that if you were using an IDE with code completion you would see that your statement is false. The ApplicationContext does have the method getBean, as shown in the spring docs
We use it all the time, so I know its there.
The samples are not perfect but they have helped thousands of people find their way so you may want to look a little deeper and do some testing before saying they are "unusable".

Paul

On Sun, Nov 1, 2009 at 9:43 AM, Thomas <iamkenzo@...> wrote:
On Thu, Oct 29, 2009 at 2:07 PM, Dominick Accattato <dominick@...> wrote:
> btw, we have listed several ways on how to get the applicationContext up on
> the trac.red5.org site under documentation.

The examples provided are unclear and thus unusable. I tried compiling
the stuff posted and it didn't work. I added an I to the class names
and it did compile, but "now what?". ApplicationContext#getBean does
not exist although it's posted as such on the samples' page.

My goal is to get the list of all currently published streams. How to do that?

--
VOD & visioconference - http://www.digiprof.tv

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



--
http://gregoire.org/
http://code.google.com/p/red5/
http://code.google.com/p/blue5/

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

Re: Query server status from outside

by Thomas-128 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, Nov 1, 2009 at 7:02 PM, Mondain <mondain@...> wrote:
> If i have time later i'll post how to get the stream names, but for now I
> would like to point out that if you were using an IDE with code completion
> you would see that your statement is false. The ApplicationContext does have
> the method getBean, as shown in the spring docs
> http://static.springsource.org/spring/docs/2.5.6/api/org/springframework/beans/factory/BeanFactory.html

Okayyyyyyyyyyy! Now I get it!

How did you want me to guess that the damn ApplicationContext was part
of Spring??? I was looking in the red5 api and couldn't find the
ApplicationContext class! Well I could have guessed from the php
example, but that's because I know it now.

Red5 definitely needs a better "getting started", "FAQ", and "how-to" pages.

--
VOD & visioconference - http://www.digiprof.tv

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

Re: Query server status from outside

by Hugo Flambó :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey Thomas...

I don't  know if I'm correct..maybe Paul can give to us a hint :D

But if you look into the class StreamUtils there's a method to get
stream by name... inside there's an Map all streams maybe created with
this class... I guess you can extended and create a method to return
the Map with all streams... no t sure it works...

Another option, maybe the right one ;) it apparently looks good to
me...I'll try it when I have time...(just got back from weekend and
trying to get up to date with all stuff..)


IServerStream stream = StreamUtils.getServerStream(appScope, this.name);

You can try this:

IProviderService providerService = (IProviderService)
appScope.getContext().getBean(IProviderService.BEAN_NAME);
List streams = providerService.getBroadcastStreamNames(appScope);


BR

Hugo
On Sun, Nov 1, 2009 at 6:02 PM, Mondain <mondain@...> wrote:

> If i have time later i'll post how to get the stream names, but for now I
> would like to point out that if you were using an IDE with code completion
> you would see that your statement is false. The ApplicationContext does have
> the method getBean, as shown in the spring docs
> http://static.springsource.org/spring/docs/2.5.6/api/org/springframework/beans/factory/BeanFactory.html
> We use it all the time, so I know its there.
> The samples are not perfect but they have helped thousands of people find
> their way so you may want to look a little deeper and do some testing before
> saying they are "unusable".
> Paul
>
> On Sun, Nov 1, 2009 at 9:43 AM, Thomas <iamkenzo@...> wrote:
>>
>> On Thu, Oct 29, 2009 at 2:07 PM, Dominick Accattato <dominick@...>
>> wrote:
>> > btw, we have listed several ways on how to get the applicationContext up
>> > on
>> > the trac.red5.org site under documentation.
>>
>> The examples provided are unclear and thus unusable. I tried compiling
>> the stuff posted and it didn't work. I added an I to the class names
>> and it did compile, but "now what?". ApplicationContext#getBean does
>> not exist although it's posted as such on the samples' page.
>>
>> My goal is to get the list of all currently published streams. How to do
>> that?
>>
>> --
>> VOD & visioconference - http://www.digiprof.tv
>>
>> _______________________________________________
>> Red5 mailing list
>> Red5@...
>> http://osflash.org/mailman/listinfo/red5_osflash.org
>
>
>
> --
> http://gregoire.org/
> http://code.google.com/p/red5/
> http://code.google.com/p/blue5/
>
> _______________________________________________
> Red5 mailing list
> Red5@...
> http://osflash.org/mailman/listinfo/red5_osflash.org
>
>

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

Re: Query server status from outside

by Andy Shaules :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

How did you want me to guess that the **** programer was missing basic java
know-how. As easy as it is to make the most complex frameworks talk for the
RIA's we make, it takes a HUGE body of experience and what is missong in
that body must be made up with equal amounts of patience.

To make simple servlet, add this to web.xml You need two things, a name and
mapping element.
And of course to write the class and compile/deploy it. Once done you can
hit it like a regular webpage.

http://localhost:5080/jservlets/webauth

<servlet>
<servlet-name>javex</servlet-name>
<description>Test</description>
<servlet-class>com.domain.servlet.yourName</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>javex</servlet-name>
<url-pattern>/webauth</url-pattern>
</servlet-mapping>



then make your servlet handler and extend HttpServlet.

package com.domain.servlet;

public class yourName extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException,

IOException {
// System.out.println(request.getContextPath());
ApplicationContext appCtx = (ApplicationContext)
WebApplicationContextUtils.getWebApplicationContext(request
.getSession().getServletContext());
Application app = (Application) appCtx.getBean("web.handler");
response.getOutputStream().write("Red5".getBytes());
}

}



----- Original Message -----
From: "Thomas" <iamkenzo@...>
To: <red5@...>
Sent: Sunday, November 01, 2009 10:16 AM
Subject: Re: [Red5] Query server status from outside


> On Sun, Nov 1, 2009 at 7:02 PM, Mondain <mondain@...> wrote:
>> If i have time later i'll post how to get the stream names, but for now I
>> would like to point out that if you were using an IDE with code
>> completion
>> you would see that your statement is false. The ApplicationContext does
>> have
>> the method getBean, as shown in the spring docs
>> http://static.springsource.org/spring/docs/2.5.6/api/org/springframework/beans/factory/BeanFactory.html
>
> Okayyyyyyyyyyy! Now I get it!
>
> How did you want me to guess that the damn ApplicationContext was part
> of Spring??? I was looking in the red5 api and couldn't find the
> ApplicationContext class! Well I could have guessed from the php
> example, but that's because I know it now.
>
> Red5 definitely needs a better "getting started", "FAQ", and "how-to"
> pages.
>
> --
> VOD & visioconference - http://www.digiprof.tv
>
> _______________________________________________
> Red5 mailing list
> Red5@...
> http://osflash.org/mailman/listinfo/red5_osflash.org
>


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

Re: Query server status from outside

by Thomas-128 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> ApplicationContext appCtx = (ApplicationContext)
> WebApplicationContextUtils.getWebApplicationContext(request
> .getSession().getServletContext());
> Application app = (Application) appCtx.getBean("web.handler");
> response.getOutputStream().write("Red5".getBytes());


Then I added:
IProviderService provider_service =
(IProviderService)app_context.getBean(IProviderService.BEAN_NAME);
List<String> streams = provider_service.getBroadcastStreamNames(app.getScope());

Although, a stream is being broadcasted, streams is always empty.

That (almost) same code put inside
ApplicationAdapter#streamSubscriberStart works and displays the list
of currently available stream names. But outside ApplicationAdapter,
it misses something. What is it?

--
VOD & visioconference - http://www.digiprof.tv

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

Re: Query server status from outside

by Thomas-128 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Should read:
> List<String> streams = app.getBroadcastStreamNames();

But now I'm having a problem, I need to provide a scope which I don't
have within my servlet.

So I thought of using RTMPClient to connect as a special client to
query the application. But the docs at
http://dl.fancycode.com/red5/api/org/red5/server/net/rtmp/RTMPClient.html
are really weak. What's the server argument? A string, great. What do
I put in it? It doesn't say.

I think I got it more or less working, but when connecting, I'd like
to specify a room name, but I didn't understand how to do that. On the
red5 app side, it seems to create a null room and it doesn't like it.

--
VOD & visioconference - http://www.digiprof.tv

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

Re: Query server status from outside

by Thomas-128 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm wasting my time trying to use RTMPClient#connect, it needs usage
samples on how to connect (like from flash player) to a server, on a
given port, to a specific room with some connection params (if
applicable).


--
VOD & visioconference - http://www.digiprof.tv

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

Re: Query server status from outside

by Thomas-128 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Oct 29, 2009 at 2:06 PM, Dominick Accattato <dominick@...> wrote:
> create a servlet that can be called from your application.  The servlet just
> needs to grab the applicationContext which can then be used to resolve
> scopes.  Once you've got a listing of your scopes, you can grab the
> connections/clients or whatever you need.
Argh! I forgot about Dominick's message. Now I'm back to getting the
child scope names.

--
VOD & visioconference - http://www.digiprof.tv

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

Re: Query server status from outside

by Hugo Flambó :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

i don't know what your trying to do...
yes... with RTMPClient you have to specify connection parameters for
the application...

Client

        String host = "localhost";
        String app = "oflaDemo";
        int port = 1935;


        public MyRTMPClient() {
                super();

                log.debug("connecting, host: " + host + ", app: " + app + ", port: " + port);
                connect(host, port, app, this);
               
                log.debug("connection done.");
        }


I think that the scope is only available on the red5 application...I
don't know any way for the client obtain it because scope is
registered on Application start on the server part... I'm not an
expert too :D

I guess that your client can connect to the red5 application and make
a call to a method on that application that retrieves to your client
what you want...in this case the list of streams.... in a client /
server fashion...

BR

Hugo



On Sun, Nov 1, 2009 at 9:36 PM, Thomas <iamkenzo@...> wrote:

> I'm wasting my time trying to use RTMPClient#connect, it needs usage
> samples on how to connect (like from flash player) to a server, on a
> given port, to a specific room with some connection params (if
> applicable).
>
>
> --
> VOD & visioconference - http://www.digiprof.tv
>
> _______________________________________________
> Red5 mailing list
> Red5@...
> http://osflash.org/mailman/listinfo/red5_osflash.org
>

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

Re: Query server status from outside

by Thomas-128 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi hugo,

You are missing a room name (or scope, well whatever name you call
it); and connection args, the ones you get back in appConnect as the
"Object[] params" argument.

I am following Dominick's advise, but I don't know how to resolve
scopes from my application_context object.

I'm sure I'm only 5 lines of code away from the solution.

--
VOD & visioconference - http://www.digiprof.tv

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

Re: Query server status from outside

by Hugo Flambó :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hmmmm

maybe something like this...

ApplicationContext appCtx = (ApplicationContext)
WebApplicationContextUtils.getWebApplicationContext(request.getSession().getServletContext());
                WebScope ws = (WebScope) appCtx.getBean("web.scope");
                Iterator it = ws.getScopeNames();
                IProviderService providerService = null;
                while(it.hasNext()){
                        IScope ss = ws.getScope((String)it.next());
                        providerService = (IProviderService)
ss.getContext().getBean(IProviderService.BEAN_NAME);
                        List streamsCurrentScope = providerService.getBroadcastStreamNames(ss);
                        List streamsGlobalScope =
providerService.getBroadcastStreamNames(ss.getContext().getGlobalScope());
                }

i don't want to confuse you...

On Sun, Nov 1, 2009 at 10:06 PM, Thomas <iamkenzo@...> wrote:

> Hi hugo,
>
> You are missing a room name (or scope, well whatever name you call
> it); and connection args, the ones you get back in appConnect as the
> "Object[] params" argument.
>
> I am following Dominick's advise, but I don't know how to resolve
> scopes from my application_context object.
>
> I'm sure I'm only 5 lines of code away from the solution.
>
> --
> VOD & visioconference - http://www.digiprof.tv
>
> _______________________________________________
> Red5 mailing list
> Red5@...
> http://osflash.org/mailman/listinfo/red5_osflash.org
>

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

Re: Query server status from outside

by Thomas-128 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> WebScope ws = (WebScope) appCtx.getBean("web.scope");
Well you are confusing me, because on the magic page they talk about:
Application app = (Application) appCtx.getBean("web.handler");


--
VOD & visioconference - http://www.digiprof.tv

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

Re: Query server status from outside

by Hugo Flambó :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

yes handler is the current red5 app ... look into red5-web.xml


you have spring beans like....


<bean id="web.scope" class="org.red5.server.WebScope"
                 init-method="register">
                <property name="server" ref="red5.server" />
                <property name="parent" ref="global.scope" />
                <property name="context" ref="web.context" />
                <property name="handler" ref="web.handler" />
                <property name="contextPath" value="${webapp.contextPath}" />
                <property name="virtualHosts" value="${webapp.virtualHosts}" />
        </bean>

       
<bean id="web.handler" class="org.red5.test.Application" />


you can see..that web.handler is referenced by web.scope  bean...



On Sun, Nov 1, 2009 at 10:31 PM, Thomas <iamkenzo@...> wrote:

>> WebScope ws = (WebScope) appCtx.getBean("web.scope");
> Well you are confusing me, because on the magic page they talk about:
> Application app = (Application) appCtx.getBean("web.handler");
>
>
> --
> VOD & visioconference - http://www.digiprof.tv
>
> _______________________________________________
> Red5 mailing list
> Red5@...
> http://osflash.org/mailman/listinfo/red5_osflash.org
>

_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org
< Prev | 1 - 2 | Next >