Messaging services struggle

View: New views
6 Messages — Rating Filter:   Alert me  

Messaging services struggle

by Ettore Paolillo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm struggling with getting RED5 messaging services to work with a Flex
client. In particular it isn't clear to me how to define and set a suitable
channel for the "producer" and "consumer" entities in the client.

Can messaging work over rtmp or is it limited to http channels?
Also, how should I configure red5-web.xml to enable support for messaging?
Are there any examples or tutorials I could consider similar to the
excellent J. Bauch "Migration Guide" which helped me a lot in setting up
Remote Object support?

I'm sorry for the many questions but even after a lot of googling and
searching through the mailing list it appears that messaging and data-push
is one of the less debated issues in RED5.

Thank you in advance for any light you will shed on this topic.
Regards,
Ettore


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

Re: Messaging services struggle

by Walter Tak :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Messaging is nothing more than sending a fews string to one specific or all
clients from the server.

You'd want to create your own method/function in Red5 that will accept a few
parameters like:

public void incomingMessage( String msgText, String msgTarget ) {
    // if the target is empty we'll send the message to all clients
connected to this room/scroop
    // if the target has an ID we'll iterate through all connections and see
if one has that ID and then send the message to that single connection
}

On the flash/flex side you could create a custom function as well, that
you'd add to the client object of NetConnection , something like:

function incomingMessage(msgText:String, msgSenderID:String, msgSenderName)
{
    // if the sender is a ID then it's a private incoming message,
especially for you, put the message in a private popup box or somethign
    // if the sender is empty then it's a public message that should be
printed in the public/generic textarea
}

Best OOP practise is to create a new class and use that as the client object
e.g.

...
connection = new NetConnection();
connection.client = new CustomClientNetConnection();
...
class CustomClientNetConnection{
    public function incomingMessage(msgText:String, msgSenderID:String,
msgSenderName):void {
        // do stuff
    }
}
...

You get the idea.

Walter


> Hi,
>
> I'm struggling with getting RED5 messaging services to work with a Flex
> client. In particular it isn't clear to me how to define and set a
> suitable
> channel for the "producer" and "consumer" entities in the client.
>
> Can messaging work over rtmp or is it limited to http channels?
> Also, how should I configure red5-web.xml to enable support for messaging?
> Are there any examples or tutorials I could consider similar to the
> excellent J. Bauch "Migration Guide" which helped me a lot in setting up
> Remote Object support?
>
> I'm sorry for the many questions but even after a lot of googling and
> searching through the mailing list it appears that messaging and data-push
> is one of the less debated issues in RED5.
>
> Thank you in advance for any light you will shed on this topic.
> Regards,
> Ettore


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

R: Messaging services struggle

by Ettore Paolillo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you for the insight. But then, what's the use of the messaging classes
(org.red5.compatibility.flex.messaging.messages.*). They appear suited to
deal with destinations, channels, consumers, producers and so on and with a
messaging model based on a produce/subscribe model. I may be dead wrong, but
I can't understand what else these classas could be about.
Any hints?
Regards,
Ettore

> -----Messaggio originale-----
> Da: red5-bounces@... [mailto:red5-bounces@...] Per conto
> di Walter Tak
> Inviato: mercoledì 1 luglio 2009 15.27
> A: red5@...
> Oggetto: Re: [Red5] Messaging services struggle
>
> Messaging is nothing more than sending a fews string to one specific or
> all
> clients from the server.
>
> You'd want to create your own method/function in Red5 that will accept a
> few
> parameters like:
>
> public void incomingMessage( String msgText, String msgTarget ) {
>     // if the target is empty we'll send the message to all clients
> connected to this room/scroop
>     // if the target has an ID we'll iterate through all connections and
> see
> if one has that ID and then send the message to that single connection
> }
>
> On the flash/flex side you could create a custom function as well, that
> you'd add to the client object of NetConnection , something like:
>
> function incomingMessage(msgText:String, msgSenderID:String,
> msgSenderName)
> {
>     // if the sender is a ID then it's a private incoming message,
> especially for you, put the message in a private popup box or somethign
>     // if the sender is empty then it's a public message that should be
> printed in the public/generic textarea
> }
>
> Best OOP practise is to create a new class and use that as the client
> object
> e.g.
>
> ...
> connection = new NetConnection();
> connection.client = new CustomClientNetConnection();
> ...
> class CustomClientNetConnection{
>     public function incomingMessage(msgText:String, msgSenderID:String,
> msgSenderName):void {
>         // do stuff
>     }
> }
> ...
>
> You get the idea.
>
> Walter
>
>
> > Hi,
> >
> > I'm struggling with getting RED5 messaging services to work with a Flex
> > client. In particular it isn't clear to me how to define and set a
> > suitable
> > channel for the "producer" and "consumer" entities in the client.
> >
> > Can messaging work over rtmp or is it limited to http channels?
> > Also, how should I configure red5-web.xml to enable support for
> messaging?
> > Are there any examples or tutorials I could consider similar to the
> > excellent J. Bauch "Migration Guide" which helped me a lot in setting up
> > Remote Object support?
> >
> > I'm sorry for the many questions but even after a lot of googling and
> > searching through the mailing list it appears that messaging and data-
> push
> > is one of the less debated issues in RED5.
> >
> > Thank you in advance for any light you will shed on this topic.
> > Regards,
> > Ettore
>
>
> _______________________________________________
> 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: R: Messaging services struggle

by Walter Tak :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Never used those. I rather create relative simple pieces of code myself than
trying to get complex non-well-documented classes to work.

Just break down your needs on paper. Start drawing some boxes and arrows.
Write down functions, methods, requests, parameters, values etc.

Then start writing a simple application (red5/java) and some Flash/Flex
functions. You'll be surprised how fast you'll have a working base.

And the best thing ; you invest in your architecture , application and
coding-skills instead of trying to figure out what the author of that
pre-made class
had in mind when he was designing and developing his classes.

In the end your own classes might look more or less the same but that time
you'll know how and why the code works.

----- Original Message -----
From: "Ettore Paolillo" <Ettore.Paolillo@...>
To: <red5@...>
Sent: Wednesday, 01 July 2009 17:33
Subject: [Red5] R: Messaging services struggle


Thank you for the insight. But then, what's the use of the messaging classes
(org.red5.compatibility.flex.messaging.messages.*). They appear suited to
deal with destinations, channels, consumers, producers and so on and with a
messaging model based on a produce/subscribe model. I may be dead wrong, but
I can't understand what else these classas could be about.
Any hints?
Regards,
Ettore

> -----Messaggio originale-----
> Da: red5-bounces@... [mailto:red5-bounces@...] Per conto
> di Walter Tak
> Inviato: mercoledì 1 luglio 2009 15.27
> A: red5@...
> Oggetto: Re: [Red5] Messaging services struggle
>
> Messaging is nothing more than sending a fews string to one specific or
> all
> clients from the server.
>
> You'd want to create your own method/function in Red5 that will accept a
> few
> parameters like:
>
> public void incomingMessage( String msgText, String msgTarget ) {
>     // if the target is empty we'll send the message to all clients
> connected to this room/scroop
>     // if the target has an ID we'll iterate through all connections and
> see
> if one has that ID and then send the message to that single connection
> }
>
> On the flash/flex side you could create a custom function as well, that
> you'd add to the client object of NetConnection , something like:
>
> function incomingMessage(msgText:String, msgSenderID:String,
> msgSenderName)
> {
>     // if the sender is a ID then it's a private incoming message,
> especially for you, put the message in a private popup box or somethign
>     // if the sender is empty then it's a public message that should be
> printed in the public/generic textarea
> }
>
> Best OOP practise is to create a new class and use that as the client
> object
> e.g.
>
> ...
> connection = new NetConnection();
> connection.client = new CustomClientNetConnection();
> ...
> class CustomClientNetConnection{
>     public function incomingMessage(msgText:String, msgSenderID:String,
> msgSenderName):void {
>         // do stuff
>     }
> }
> ...
>
> You get the idea.
>
> Walter
>
>
> > Hi,
> >
> > I'm struggling with getting RED5 messaging services to work with a Flex
> > client. In particular it isn't clear to me how to define and set a
> > suitable
> > channel for the "producer" and "consumer" entities in the client.
> >
> > Can messaging work over rtmp or is it limited to http channels?
> > Also, how should I configure red5-web.xml to enable support for
> messaging?
> > Are there any examples or tutorials I could consider similar to the
> > excellent J. Bauch "Migration Guide" which helped me a lot in setting up
> > Remote Object support?
> >
> > I'm sorry for the many questions but even after a lot of googling and
> > searching through the mailing list it appears that messaging and data-
> push
> > is one of the less debated issues in RED5.
> >
> > Thank you in advance for any light you will shed on this topic.
> > Regards,
> > Ettore


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

Re: R: Messaging services struggle

by Dominick Accattato-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You are correct, They are meant to work with those clientside classes.  Joachim had implemented that functionality.  Maybe he'll chime in.


On Wed, Jul 1, 2009 at 11:33 AM, Ettore Paolillo <Ettore.Paolillo@...> wrote:
Thank you for the insight. But then, what's the use of the messaging classes
(org.red5.compatibility.flex.messaging.messages.*). They appear suited to
deal with destinations, channels, consumers, producers and so on and with a
messaging model based on a produce/subscribe model. I may be dead wrong, but
I can't understand what else these classas could be about.
Any hints?
Regards,
Ettore

> -----Messaggio originale-----
> Da: red5-bounces@... [mailto:red5-bounces@...] Per conto
> di Walter Tak
> Inviato: mercoledì 1 luglio 2009 15.27
> A: red5@...
> Oggetto: Re: [Red5] Messaging services struggle
>
> Messaging is nothing more than sending a fews string to one specific or
> all
> clients from the server.
>
> You'd want to create your own method/function in Red5 that will accept a
> few
> parameters like:
>
> public void incomingMessage( String msgText, String msgTarget ) {
>     // if the target is empty we'll send the message to all clients
> connected to this room/scroop
>     // if the target has an ID we'll iterate through all connections and
> see
> if one has that ID and then send the message to that single connection
> }
>
> On the flash/flex side you could create a custom function as well, that
> you'd add to the client object of NetConnection , something like:
>
> function incomingMessage(msgText:String, msgSenderID:String,
> msgSenderName)
> {
>     // if the sender is a ID then it's a private incoming message,
> especially for you, put the message in a private popup box or somethign
>     // if the sender is empty then it's a public message that should be
> printed in the public/generic textarea
> }
>
> Best OOP practise is to create a new class and use that as the client
> object
> e.g.
>
> ...
> connection = new NetConnection();
> connection.client = new CustomClientNetConnection();
> ...
> class CustomClientNetConnection{
>     public function incomingMessage(msgText:String, msgSenderID:String,
> msgSenderName):void {
>         // do stuff
>     }
> }
> ...
>
> You get the idea.
>
> Walter
>
>
> > Hi,
> >
> > I'm struggling with getting RED5 messaging services to work with a Flex
> > client. In particular it isn't clear to me how to define and set a
> > suitable
> > channel for the "producer" and "consumer" entities in the client.
> >
> > Can messaging work over rtmp or is it limited to http channels?
> > Also, how should I configure red5-web.xml to enable support for
> messaging?
> > Are there any examples or tutorials I could consider similar to the
> > excellent J. Bauch "Migration Guide" which helped me a lot in setting up
> > Remote Object support?
> >
> > I'm sorry for the many questions but even after a lot of googling and
> > searching through the mailing list it appears that messaging and data-
> push
> > is one of the less debated issues in RED5.
> >
> > Thank you in advance for any light you will shed on this topic.
> > Regards,
> > Ettore
>
>
> _______________________________________________
> Red5 mailing list
> Red5@...
> http://osflash.org/mailman/listinfo/red5_osflash.org


_______________________________________________
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: R: Messaging services struggle

by Ettore Paolillo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

That's what I thought and even if I can see the point raised by Walter, I don't want (and am not able) to reinvent the wheel. So I would like to use what's available for implementing server data-push and messaging. I have the following code (simplified):

 

In the Flex client:

 

      ....

<mx:Panel id="msgPanel" autoLayout="true" title="Chat" x="450" width="300" height="400">

            <mx:TextArea id="viewMes" width="100%" height="100%" />

            <mx:ControlBar>

                  <mx:TextInput id="chatMes" width="100%" />

                  <mx:Button id="sendMes" label="Send" click="chatPublisher.send(new AsyncMessage({msg:chatMes.text}));"/>

            </mx:ControlBar>

      </mx:Panel>

     

      <mx:Script>

            <![CDATA[

 

      ....

var cs:ChannelSet = new ChannelSet();

var newChannel:Channel = new AMFChannel("msgChannel", "http://localhost:5080/R5_PeopleGrid/gateway");

//var newChannel:Channel = new AMFChannel("msgChannel", "rtmp://localhost:1935/R5_PeopleGrid");

cs.addChannel(newChannel);

 

chatPublisher = new Producer();

chatPublisher.channelSet = cs;

chatPublisher.destination = "Red5Chat";

                       

chatConsumer = new Consumer();

chatConsumer.destination = "Red5Chat";

chatConsumer.channelSet = cs;

                       

chatConsumer.addEventListener(MessageEvent.MESSAGE, msgRcvdHandler, false, 0, true);

chatConsumer.subscribe();

      ....             

 

      function msgRcvdHandler(evt:MessageEvent):void {

            Alert.show("Message received", "Messaging Service");

            viewMes.text += evt.message.body + "\n";

      }

 

In red5-web.xml:

 

      <bean id="my.chat"

            class="org.red5.core.ChatService"

            singleton="true" />

     

     

    <!-- enable support for mx:RemoteObject requests -->

    <bean id="flexMessaging.service" class="org.red5.server.net.remoting.FlexMessagingService">

        <property name="serviceInvoker" ref="global.serviceInvoker" />

        <!-- add an entry for all possible "destination" attributes of your

             mx:RemoteObject sources -->

        <property name="endpoints">

            <map>

                <entry key="Red5Chat">

                          <ref bean="my.chat" />

                      </entry>

 

            </map>

        </property>

    </bean>

 

 

In ChatService:

 

package org.red5.core;

 

import org.red5.server.adapter.ApplicationAdapter;

import org.red5.compatibility.flex.messaging.messages.*;

 

public class ChatService extends ApplicationAdapter{

 

      public ChatService() {

            System.out.println("ChatService: Started!");

            AsyncMessage myMsg = new AsyncMessage();

            myMsg.destination = "RED5Chat";

            myMsg.body = "HELLO WORLD!";

      }

}

 

Nevertheless when I launch the application I get the following error:

 

[ERROR] [http-5080-1] org.red5.server.net.remoting.FlexMessagingService - Unknown Flex compatibility request: org.red5.compatibility.flex.messaging.messages.AsyncMessage(ts=0,headers={DSId=nil, DSEndpoint=msgChannel},body={msg=testChat},messageId=C4BF3573-495A-6BAA-4F54-381552901AB6,timeToLive=0,clientId=2F72C3C3-C335-28A4-8C6C-A245FC2DBE6F,destination=Red5Chat,correlationId=)

 

Anyone has any idea of what I’m doing wrong?

 

Regards,

Ettore

________________________________________

Da: red5-bounces@... [mailto:red5-bounces@...] Per conto di Dominick Accattato

Inviato: mercoledì 1 luglio 2009 21.44

A: red5@...

Oggetto: Re: [Red5] R: Messaging services struggle

 

You are correct, They are meant to work with those clientside classes.  Joachim had implemented that functionality.  Maybe he'll chime in.

 

On Wed, Jul 1, 2009 at 11:33 AM, Ettore Paolillo <Ettore.Paolillo@...> wrote:

Thank you for the insight. But then, what's the use of the messaging classes

(org.red5.compatibility.flex.messaging.messages.*). They appear suited to

deal with destinations, channels, consumers, producers and so on and with a

messaging model based on a produce/subscribe model. I may be dead wrong, but

I can't understand what else these classas could be about.

Any hints?

Regards,

Ettore

 

> -----Messaggio originale-----

> Da: red5-bounces@... [mailto:red5-bounces@...] Per conto

> di Walter Tak

> Inviato: mercoledì 1 luglio 2009 15.27

> A: red5@...

> Oggetto: Re: [Red5] Messaging services struggle

> 

> Messaging is nothing more than sending a fews string to one specific or

> all

> clients from the server.

> 

> You'd want to create your own method/function in Red5 that will accept a

> few

> parameters like:

> 

> public void incomingMessage( String msgText, String msgTarget ) {

>     // if the target is empty we'll send the message to all clients

> connected to this room/scroop

>     // if the target has an ID we'll iterate through all connections and

> see

> if one has that ID and then send the message to that single connection

> }

> 

> On the flash/flex side you could create a custom function as well, that

> you'd add to the client object of NetConnection , something like:

> 

> function incomingMessage(msgText:String, msgSenderID:String,

> msgSenderName)

> {

>     // if the sender is a ID then it's a private incoming message,

> especially for you, put the message in a private popup box or somethign

>     // if the sender is empty then it's a public message that should be

> printed in the public/generic textarea

> }

> 

> Best OOP practise is to create a new class and use that as the client

> object

> e.g.

> 

> ...

> connection = new NetConnection();

> connection.client = new CustomClientNetConnection();

> ...

> class CustomClientNetConnection{

>     public function incomingMessage(msgText:String, msgSenderID:String,

> msgSenderName):void {

>         // do stuff

>     }

> }

> ...

> 

> You get the idea.

> 

> Walter

> 

> 

> > Hi,

> >

> > I'm struggling with getting RED5 messaging services to work with a Flex

> > client. In particular it isn't clear to me how to define and set a

> > suitable

> > channel for the "producer" and "consumer" entities in the client.

> >

> > Can messaging work over rtmp or is it limited to http channels?

> > Also, how should I configure red5-web.xml to enable support for

> messaging?

> > Are there any examples or tutorials I could consider similar to the

> > excellent J. Bauch "Migration Guide" which helped me a lot in setting up

> > Remote Object support?

> >

> > I'm sorry for the many questions but even after a lot of googling and

> > searching through the mailing list it appears that messaging and data-

> push

> > is one of the less debated issues in RED5.

> >

> > Thank you in advance for any light you will shed on this topic.

> > Regards,

> > Ettore

> 

> 

> _______________________________________________

> Red5 mailing list

> Red5@...

> http://osflash.org/mailman/listinfo/red5_osflash.org

 

 

_______________________________________________

Red5 mailing list

Red5@...

http://osflash.org/mailman/listinfo/red5_osflash.org

 


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