OpenRTMFP / Cumulus

CumulusServer is a complete open source and cross-platform RTMFP server extensible by way of scripting
http://groups.google.com/group/openrtmfp-cumulus
GNU General Public License v3.0
593 stars 221 forks source link

How I can get in flash player all peerID of rtmfp netGroup #60

Closed zion03 closed 12 years ago

zion03 commented 12 years ago

How I can get in flash player all peerID from rtmfp netGroup? I thought send the GroupID from Flash Player into a function on LUA, then in loop select all participants of group, but unfortunately I can not find the group ID on the client side. Where I can find the GroupID on client side or maybe exists another way. Thamnks!

leobrennan commented 12 years ago

Using the Lua script you can set up a call so you input a groupID and return an array of peerID's very similar to joining a group except you don't join.

If you are not sure if that group exist then set up another call so you input a groupID and return if there is or isn't a group.

As for finding out all the groupID's that is a little more tricky, personally I know what a groupID is based off of something else eg using a person name and the person's date of birth. Although that's not unique but you should not be giving a groupID as just a random number as you have no way of knowing what group other people could be in You could set up a call to return all groupIDs but not sure that is good.

zion03 commented 12 years ago

And way I can get peer id's (without my) during my connect to netGroup. This option is right for me, but event NetGroup.Connect.Success only contain info.group values. In this way I know count of group participants, but I don't know anything about peer id`s.

zion03 commented 12 years ago

I wrote this to solve this problem: function onJoinGroup(client,group) for i,v in group.ipairs() do print('---------') print(i,v.id) print('----------') end end But now I have a new problem, how correctly return and receive this data in flash player. From the documentation I realized that this must be done through the FlowWriter, but I can't understand how make this. The perfect for me return this variables in NetGroup.Connect.Success event.

cumulusdev commented 12 years ago

In a true NetGroup usage, every member doesn't know all its other neighbors, it's the purpose of "NetGroup:estimatedMemberCount" property, we can only get an approximation value. The protocol is done like that to be a "true P2P mesh". Each peer knows only its direct neighbors.

If you want to create a P2P group where everybodoy knows everybodoy, you should'nt use NetGroup feature zion03, but simply create a "virtual" group where everybody is connected to everybody by direct P2P connection.

Now, if you want to send some custom data to the client, use flowWriter object yes, you get it with "client.writer". For more details read the "Communication between client and server" part of https://github.com/OpenRTMFP/Cumulus/wiki/Server-Application page, and "FlowWriter" API description on https://github.com/OpenRTMFP/Cumulus/wiki/Server-Application,-API page. And it's impossible to add a property on the "NetGroup.Connect.Success" event.

zion03 commented 12 years ago

I want try to build chat (with multi room), and I don't think that direct connection between a peer's will be a good idea. And I need to know during connecting to netGgroup all participant for painting interface. For example If two users are available in chat, and new user will connection to this group, this new user must receive information about two user who already in this group. The most interesting is that all this information is already contained on the server and I need only get this in the client side. How can I do it?

I try do something like this:

In server side function onJoinGroup(client,group) client.writer:writeAMFMessage("onPushData","Example","ForExample") end In client side function onPushData(name:String,firstName:String):void { }

And have folowing error Error #2044: AsyncErrorEvent:. text=Error #2095: flash.net.NetConnection failed to implement a callback. error=ReferenceError: Error #1069: Unable to find property in the test; there is no default value. '

I will be happy to any answer.

cumulusdev commented 12 years ago

_netConnection.client = this; ... public function onPushData(name:String,firstName:String):void { }

The function should be "public" and you have to change the "client" property of your NetConnection instance.

zion03 commented 12 years ago

Made changes but the problem remains. Full code: private var nc:NetConnection; private var netGroup:NetGroup;

        `private function connect():void{
            nc = new NetConnection();
            nc.client = this;
            nc.addEventListener(NetStatusEvent.NET_STATUS,netStatus);
            nc.connect("rtmfp://127.0.0.1:1935/");  

        }

        private function netStatus(event:NetStatusEvent):void{

            switch(event.info.code){
                case "NetConnection.Connect.Success":
                    setupGroup();
                    break;
            }
        }

        private function setupGroup():void{
            var groupspec:GroupSpecifier = new GroupSpecifier("myGroup/g3");
            groupspec.serverChannelEnabled = true;
            groupspec.postingEnabled = true;
            groupspec.multicastEnabled = true;

            netGroup = new NetGroup(nc,groupspec.groupspecWithoutAuthorizations());
            netGroup.addEventListener(NetStatusEvent.NET_STATUS,netStatus);

            txt.text+="setGroup";
        }

        public function onPushData(name:String,firstName:String):void {
            txt.text+=name;
        }`
cumulusdev commented 12 years ago

what is the error message please?

2012/3/8 zion03 < reply@reply.github.com

Made changes but the problem remains. Full code: private var nc:NetConnection; private var netGroup:NetGroup;

                   `private function connect():void{
                           nc = new NetConnection();
                           nc.client = this;

nc.addEventListener(NetStatusEvent.NET_STATUS,netStatus); nc.connect("rtmfp://127.0.0.1:1935/");

                   }

                   private function

netStatus(event:NetStatusEvent):void{

                           switch(event.info.code){
                                   case

"NetConnection.Connect.Success": setupGroup(); break; } }

                   private function setupGroup():void{
                           var groupspec:GroupSpecifier = new

GroupSpecifier("myGroup/g3"); groupspec.serverChannelEnabled = true; groupspec.postingEnabled = true; groupspec.multicastEnabled = true;

                           netGroup = new

NetGroup(nc,groupspec.groupspecWithoutAuthorizations());

netGroup.addEventListener(NetStatusEvent.NET_STATUS,netStatus);

                           txt.text+="setGroup";
                   }

                   public function

onPushData(name:String,firstName:String):void { txt.text+=name; }`


Reply to this email directly or view it on GitHub: https://github.com/OpenRTMFP/Cumulus/issues/60#issuecomment-4399241

zion03 commented 12 years ago

First sentences I tried to translate in post above. Original message: Error #2044: Необработанный AsyncErrorEvent:. text=Error #2095: flash.net.NetConnection не удалось осуществить обратный вызов . error=ReferenceError: Error #1069: Не удалось найти свойство в phone; отсутствует значение по умолчанию. at phone/connect()[C:\Users\Dima\Adobe Flash Builder 4.6\phone\src\phone.mxml:16] at phone/___phone_Application1_applicationComplete()[C:\Users\Dima\Adobe Flash Builder 4.6\phone\src\phone.mxml:6] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:13152] at mx.managers::SystemManager/preloader_preloaderDoneHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\SystemManager.as:2676] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.preloaders::Preloader/displayClassCompleteHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\preloaders\Preloader.as:582] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.preloaders::SparkDownloadProgressBar/initCompleteHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\preloaders\SparkDownloadProgressBar.as:1087] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.preloaders::Preloader/dispatchAppEndEvent()[E:\dev\4.y\frameworks\projects\framework\src\mx\preloaders\Preloader.as:380] at mx.preloaders::Preloader/appCreationCompleteHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\preloaders\Preloader.as:590] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:13152] at mx.core::UIComponent/set initialized()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:1818] at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:842] at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1180]

cumulusdev commented 12 years ago

Can you translate me this part please: phone; .

When you said: "Unable to find property in the test; there is no default value. '` "

It's missing the name of the property! "property in the test" ???

2012/3/8 zion03 < reply@reply.github.com

First sentences I tried to translate in post above. Original message: Error #2044: AsyncErrorEvent:. text=Error #2095: flash.net.NetConnection . error=ReferenceError: Error #1069: phone; . at phone/connect()[C:\Users\Dima\Adobe Flash Builder 4.6\phone\src\phone.mxml:16] at phone/___phone_Application1_applicationComplete()[C:\Users\Dima\Adobe Flash Builder 4.6\phone\src\phone.mxml:6] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:13152] at mx.managers::SystemManager/preloader_preloaderDoneHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\SystemManager.as:2676] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.preloaders::Preloader/displayClassCompleteHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\preloaders\Preloader.as:582] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.preloaders::SparkDownloadProgressBar/initCompleteHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\preloaders\SparkDownloadProgressBar.as:1087] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.preloaders::Preloader/dispatchAppEndEvent()[E:\dev\4.y\frameworks\projects\framework\src\mx\preloaders\Preloader.as:380] at mx.preloaders::Preloader/appCreationCompleteHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\preloaders\Preloader.as:590] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:13152] at mx.core::UIComponent/set initialized()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:1818] at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:842] at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1180]


Reply to this email directly or view it on GitHub: https://github.com/OpenRTMFP/Cumulus/issues/60#issuecomment-4399411

zion03 commented 12 years ago

phone is the name of my project. (last project was named test). In error written about "Unable to find property in the phone. No default value". In the error message was written about problem in find something property in project, but name of property not displayed. What this mean, I don't know.

cumulusdev commented 12 years ago

Ok, I don't understand, if you can send me some part of source to test it here: cumulus.dev@gmail.com,

because here I don't see, all seems ok :-(

2012/3/8 zion03 < reply@reply.github.com

phone is the name of my project. (last project was named test). In error written about "Unable to find property in the phone. No default value". In the error message was written about problem in find something property in project, but name of property not displayed. What this mean, I don't know.


Reply to this email directly or view it on GitHub: https://github.com/OpenRTMFP/Cumulus/issues/60#issuecomment-4400159

cumulusdev commented 12 years ago

Actually, I have just tested the following code:

Serve side: function onJoinGroup(client,group) client.writer:writeAMFMessage("onPushData","Example","ForExample") end

Client side: public function onPushData(name:String,firstName:String):void { trace(name + " " + firstName); }

and it works perfectly

zion03 commented 12 years ago

I sent my sources. For testing in windows I using binaries version of cumulus, maybe problem in this?

zion03 commented 12 years ago

Very strange :). But in any case, thanks for your help. I'll be try to catch problem in my side, but if you will have any idea about this write me. thanks again.