Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Error in afcs.php

Avatar

Level 1

          I think there is the error in afcs.php file from serverIntegration folder of SDK on line 417.

            if (!is_array($nodes))
                $nodes = array (
                    nodes // <------ here is 417 line of afcs.php
                );

There should be $ symbol before "nodes" ?

There are another errors in this function, it looks like it is not working.

And there is another one error: I use amfphp on my server and if I don't set $USE_CURL=true in AFCS class, it causes error. Maybe, we need to use curl by default? Has anybode such errors?

10 Replies

Avatar

Employee

hey, thanks for the bug report (and sorry . I have fixed it and will be available in the next release.

I am not sure about $USE_CURL. We don't use it and it works for us. If setting it make it work for you, good

It could be that your PHP server is configured differently than what we normally use.

Let us know if you find any problem with that since, as I said, we normally don't test with CURL.

Avatar

Level 1

I found another one error in afcs.php in function subscribeCollection() on line 419-421

while (list ($i, $n) = each($nodes)) {
                $params .= "&node={$v}";
            }

It makes GET request looks like http://connectnow............&node=node1&node=node2&node=node3.

It doesn't work. So, to create new collectionNode for SimpleChat I need to make subscribeCollection(), then create new nodes with function createNode(). I have tried to do this, but createNode() don't change configuration for nodes. Here is my array for configuration:

$history = array("persistItems"=>true, "userDependentItems"=>false, "publishModel"=>10.0,"allowPrivateMessages"=>true,
                              "accessModel"=>10.0, "modifyAnyItem"=>false, "itemStorageScheme"=>1.0, "sessionDependentItems"=>true);

When I try to do my script, it creates collectionNode and nodes in it (history, history_hosts, history_participants etc. ), but it don't change options for nodes and they don't work with default nodes.

I think it must be more simplier mechanism of creaton of collectioNodes for default pods like simplechat, webcam, audio and whiteboard, but this is not working.

P.S. Sorry for my English

Avatar

Employee

I am not really sure of what your problem is exactly.

subscribeCollection accepts a list of nodes as parameters but right now doesn't do very much with it (i.e. you always subscribe to all nodes in the collection). also subscribeCollection doesn't create the nodes for you so you have to use createNode first.

I'll try and make sure that creating nodes with a specific configuration works in PHP (I may have an error in there) but I have verified that in general passing a special configuration works fine. Note that because of the way the server side works if you call getNodeConfiguration you will only get the values that are different from the default node configuration.

Finally, if you are creating multiple rooms with standard pods the easiest way is still to create the first room using a client application where you login with your developer credentials and then create a template out of that room.

Avatar

Former Community Member

Also, if you already have the node create or using a default node and you want to update the nodeConfiguration, use the setNodeConfiguration($room, $coll, $node, $configuration) in the AFCS.php.  Pass in your configuration map along with room name, collection name and node name.

Avatar

Level 1

Look, I don't need to create new rooms for chat, I need to create only new collectionNode with standart nodes for simplechat. I have to make automatic creation for private chat between users in room, but by default it's not allowed to create collectionNodes from flex with user role less than OWNER.

So, I want to use php to create collectionNodes, but when I call to function createNode($room, $coll, $node, $configuration) it creates node, but don't apply my $configuration to it.

Tell me please string format for array $configuration or give some example of using createNode with true configuration argument.

Avatar

Former Community Member

I created example based on your data.  it works for me.  following is the code.  Hope it helps

then I use getNodeConfiguration to see if the node taken what I put in.  Which came out the same as what I put in

Avatar

Level 1

Your example is good, but it's similar to my code and doesn't change configuration of nodes of the created Collection.

Please give me some work example without POST and etc, which works and changes configuration.

Here is part of my debug:

Message was edited by: mitrichaka

Avatar

Former Community Member

Here is the example values that we are setting in those configurations:

Again update value based on your need.  those values are describe in the ASDoc

Dean

Avatar

Level 1

Yeah!!! It works!

My eyes lie me, it's wrong!

It's my code:

public function createNode(){
     $roomname = "myfirstroom";
        $collectionname = "myChat_ModeratedChatModel";
        $nodename= "myprivatenode";
        $configuration = array("persistItems"=>"true",
                                "userDependentItems"=>"true",
                                "publishModel"=>10,
                                "allowPrivateMessages"=>"true",
                                "lazySubscription"=>"false",
                                "allowPrivateMessages"=>"true",
                                "accessModel"=>20,
                                "modifyAnyItem"=>"false",
                                "itemStorageScheme"=>2,
                                "sessionDependentItems"=>"true",
                                "p2pDataMessaging"=>"false");
     $collection = $this->account->subscribeCollection($roomname,$collectionname);
     $this->account->createNode($roomname,$collectionname,$nodename);
     $this->account->setNodeConfiguration($roomname,$collectionname,$nodename,$configuration);
     return $this->account->getNodeConfiguration($roomname,$collectionname,$nodename);



Please, make some docs for integration scripts, some examples, because this small question steal more than a week of my time ((

Here is debug info:

http_post: https://na2.connectnow.acrobat.com:443/app/rtc &instance=na2xxxxxxxx/myfirstroom&action=subscribe&collection=myChat_ModeratedChatModel&gak=xxxxxxxxxxxxxxxxxxxxxxxxxxx
http_post: https://na2.connectnow.acrobat.com:443/app/rtc instance=na2xxxxxxxxx/myfirstroom&action=configure&collection=myChat_ModeratedChatModel&node=myprivatenode&gak=xxxxxxxxxxxxxxxxxxxxxxxxxxx
http_post: https://na2.connectnow.acrobat.com:443/app/rtc?instance=na2xxxxxxxxx/myfirstroom&action=configure&co...
<request><configuration><field var="persistItems"><value type="string">true</value></field><field var="userDependentItems"><value type="string">true</value></field><field var="publishModel"><value type="int">10</value></field><field var="allowPrivateMessages"><value type="string">true</value></field><field var="lazySubscription"><value type="string">false</value></field><field var="accessModel"><value type="int">20</value></field><field var="modifyAnyItem"><value type="string">false</value></field><field var="itemStorageScheme"><value type="int">1</value></field><field var="sessionDependentItems"><value type="string">true</value></field><field var="p2pDataMessaging"><value type="string">false</value></field></configuration></request>
Array
(
    [Content-Type] => text/xml
)
http_get: https://na2.connectnow.acrobat.com:443/app/rtc?instance=na2xxxxxxxxxxxx/myfirstroom&path=/myChat_Mod...
"<result>\r\n<status code=\"ok\"\/>\r\n<collections><\/collections>\r\n<\/result>\r\n"

Message was edited by: mitrichaka

Avatar

Former Community Member

Hi, I ran your example, see following code, and it ran fine (see screen shot).  However, I did put the getNodeConfiguration with separate call (separate request), because setNodeConfiguration will take time to update the node, calling it immediately after setNodeConfiguration might not reflecting latest change.  Also btw, we are updating more example code.

thanks

Dean

    $configuration = array("persistItems"=>"true",

                            "userDependentItems"=>"true",

                               "publishModel"=>10, 

                               "allowPrivateMessages"=>"true",

                               "lazySubscription"=>"false",

                               "allowPrivateMessages"=>"true", 

                               "accessModel"=>20, 

                               "modifyAnyItem"=>"false",  

                               "itemStorageScheme"=>2,  

                               "sessionDependentItems"=>"true",

                               "p2pDataMessaging"=>"false");     

             $afcs->subscribeCollection($roomname,$collectionname);

        $afcs->createNode($roomname, $collectionname, $nodename);

             $afcs->setNodeConfiguration($roomname,$collectionname,$nodename,$configuration);

        echo "<h1> Create Node Sent </h1> ";

and separete request for getNodeConfigruation

result.jpg