Skip to main content
Inspiring
May 21, 2012
Question

can't receive any Netgroup event

  • May 21, 2012
  • 1 reply
  • 2295 views

hello, I am using Netgroups with FMS(rtmfp). I can connect to the Netgroup (reiceve NetStatusEvent "NetGroup.Connect.Success") but that is all. I can't post anything or see that someone has joined the Netgroup, no NetStatusEvent fires. What am I missing?

_groupSpecifier = new GroupSpecifier("test_group");

_groupSpecifier.postingEnabled = true;

_groupSpecifier.multicastEnabled = true;            

_groupSpecifier.serverChannelEnabled = true;

_netGroup = new NetGroup(_nc, _groupSpecifier.groupspecWithAuthorizations());

_netGroup.addEventListener(NetStatusEvent.NET_STATUS, groupNetStatusHandler);   

This topic has been closed for replies.

1 reply

May 21, 2012

Hi,

Can you post the full code as from the above code it's not clear what are you trying to do. If you don't want to post the full code then you can send me that as private message.

Inspiring
May 21, 2012

Here is the code. After user connects to the group, I want to send everyone in the group a message.

public function connect(url:String):void {                 
    _nc
= new NetConnection();
    _nc
.client = this;
    _nc
.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);

    _nc
.connect(url);  
}

private function netStatusHandler(event:NetStatusEvent):void {
   
switch (event.info.code){
       
case "NetConnection.Connect.Success":              
            createGroup
();
           
break;             
       
case "NetGroup.Connect.Success":                   
           
//
!!! post msg to the group, no one receives this message
           
var message:Object = new Object;                   
            message
.text = "Hello";                
            message
.sender = _nc.nearID;                   
            _netGroup
.post(message);
           
break;
       
default:                   
            trace
("event.info.code: " + event.info.code);          
           
break;
   
}              
}

private function createGroup():void {
    _groupSpecifier
= new GroupSpecifier("test_group");
    _groupSpecifier
.postingEnabled = true;
    _groupSpecifier
.multicastEnabled = true;           
    _groupSpecifier
.serverChannelEnabled = true;

    _netGroup
= new NetGroup(_nc, _groupSpecifier.groupspecWithAuthorizations());
    _netGroup
.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);       
}  

After reading documentation I am a little bit confused, if I am using FMS do I have to write some server side code to bootstrap users? And can I use netgroup.post() or I need to call my custom server side function that will go through all application clients and inform them about some action?

May 21, 2012

Before calling the post() method, you should check for the NetGroup.Neighbor.Connect event. Once this event is received then you can call the post() method. So, try creating one more client and connect to the same GroupSpecifier. And after the above mentioned event is received, call the post() method.