Expand my Community achievements bar.

SOLVED

When creating Collections and Nodes via PHP not setting storage scheme

Avatar

Level 2

Hi!
I am trying to create chat Collection and Nodes with PHP backend.
I am using this configuration as base for all nodes with small changes:

static private $CHAT_CONFIGURATION = array(
   'accessModel'=>self::ROLE_VIEWER,
   'publishModel'=>self::ROLE_VIEWER,
   'persistItems'=>true,
   'modifyAnyItem'=>false,
   'userDependentItems'=>false,
   'sessionDependentItems'=>false,
   'itemStorageScheme'=>self::STORAGE_SCHEME_QUEUE,
   'allowPrivateMessages'=>false,
   'lazySubscription'=>false,
   'p2pDataMessaging'=>false
);

STORAGE_SCHEME_QUEUE = 1
And this value not changed for any hostory_* Node
But when Node created I am trying to use chat and It can not serve more than one value. Then I've checked Node configuration through Room console and found that storage scheme has value SINGLE ITEM.When I changed it value(using Room console) to QUEUE chat started to work properly. How to set up storage scheme correctly?
Thanks!

1 Accepted Solution

Avatar

Correct answer by
Employee

Well, I still am not sure of what the issue is.

I have tested your code and it works just fine for me. After running your "createSession_chat" on a newly created room, I call getNodeConfiguration on the new nodes and this is what I get:

--- EVERYONE ---------

http_get: https://na2.collaboration.adobelivecycle.com:443/app/rtc?path=/chat_1/nodes/history/configuration

<result>

<status code="ok"/>

<collections><node id="chat_1"><collection><nodes><node id="history"><collection><configuration><field var="publishModel"><value type="double">10.0</value></field><field var="allowPrivateMessages"><value type="boolean">true</value></field><field var="modifyAnyItem"><value type="boolean">false</value></field><field var="itemStorageScheme"><value type="double">1.0</value></field></configuration><items></items></collection></node></nodes></collection></node></collections>

</result>

--- PARTICIPANTS ---------

http_get: https://na2.collaboration.adobelivecycle.com:443/app/rtc?path=/chat_1/nodes/history_participants/con...

<result>

<status code="ok"/>

<collections><node id="chat_1"><collection><nodes><node id="history_participants"><collection><configuration><field var="publishModel"><value type="double">10.0</value></field><field var="accessModel"><value type="double">50.0</value></field><field var="modifyAnyItem"><value type="boolean">false</value></field><field var="itemStorageScheme"><value type="double">1.0</value></field></configuration><items></items></collection></node></nodes></collection></node></collections>

</result>

--- HOSTS ---------

http_get: https://na2.collaboration.adobelivecycle.com:443/app/rtc?path=/chat_1/nodes/history_hosts/configurat...

<result>

<status code="ok"/>

<collections><node id="chat_1"><collection><nodes><node id="history_hosts"><collection><configuration><field var="publishModel"><value type="double">10.0</value></field><field var="accessModel"><value type="double">100.0</value></field><field var="modifyAnyItem"><value type="boolean">false</value></field><field var="itemStorageScheme"><value type="double">1.0</value></field></configuration><items></items></collection></node></nodes></collection></node></collections>

</result>

--- TYPING ---------

http_get: https://na2.collaboration.adobelivecycle.com:443/app/rtc?path=/chat_1/nodes/typing/configuration

<result>

<status code="ok"/>

<collections><node id="chat_1"><collection><nodes><node id="typing"><collection><configuration><field var="userDependentItems"><value type="boolean">true</value></field><field var="publishModel"><value type="double">10.0</value></field><field var="modifyAnyItem"><value type="boolean">false</value></field><field var="itemStorageScheme"><value type="double">2.0</value></field><field var="sessionDependentItems"><value type="boolean">true</value></field></configuration><items></items></collection></node></nodes></collection></node></collections>

</result>

The values for itemStorageScheme matches the values you used when creating the nodes.

Not sure of what disaster is going on with the Whiteboard since all you showed us up to this point was related to chat nodes, and I guess I am not planning of making any changes to the PHP code since everything seems to be working as specified.

View solution in original post

8 Replies

Avatar

Former Community Member

Wow, that's a weird one. Seems like a bug in either the PHP, or on our

service. We'll check into this one and get a fix for you hopefully in our

December release.

thanks for reporting it - feedback is always appreciated!

nigel

Avatar

Employee

Can't test PHP right now but I just did the same with Ruby and it works as expected (and given the way setNodeConfiguration works I am pretty sure that if it works in Ruby it works in any other language)

Did you try using RTC::NodeConfiguration::STORAGE_SCHEME_QUEUE instead of self::STORAGE_SCHEME_QUEUE ? (shouldn't matter, as long as it's 1, but you never know).

Also, you should enable debugging (RTC::DEBUG = true) and see what it prints out when you call setNodeConfiguration (and if you still have problems please send those messages over)

This is my Ruby code (it should look pretty similar to the PHP code) :

puts "create collection and node"

puts am.createNode("myfirstroom", "aNewCollection", "aNode")

configuration = {

  'accessModel'=>RTC::UserRole::VIEWER,

  'publishModel'=>RTC::UserRole::VIEWER,

  'persistItems'=>true,

  'modifyAnyItem'=>false,

  'userDependentItems'=>false,

  'sessionDependentItems'=>false,

  'itemStorageScheme'=>RTC::NodeConfiguration::STORAGE_SCHEME_QUEUE,

  'allowPrivateMessages'=>false,

  'lazySubscription'=>false,

  'p2pDataMessaging'=>false

}

puts "set configuration"

puts am.setNodeConfiguration("myfirstroom", "aNewCollection", "aNode", configuration)

puts "get configuration"

puts am.getNodeConfiguration("myfirstroom", "aNewCollection", "aNode")

Avatar

Level 2

Hi!

Thanks for answer.

Here is my code, that creates chat(I've changed constants as you said):

     


// collection name template

const CHAT_NAME_TEMPLATE = 'chat_';


// chat node names
const CHAT_HISTORY_NODE_EVERYONE = 'history';
const CHAT_HISTORY_NODE_PARTICIPANTS = 'history_participants';
const CHAT_HISTORY_NODE_HOSTS = 'history_hosts';
const CHAT_TYPING_NODE_NAME = 'typing';


// config template


static private $CHAT_CONFIGURATION = array(
'accessModel'=>RTCUserRole::VIEWER,
'publishModel'=>RTCUserRole::VIEWER,
'persistItems'=>true,
'modifyAnyItem'=>false,
'userDependentItems'=>false,
'sessionDependentItems'=>false,
'itemStorageScheme'=>NodeConfiguration::STORAGE_SCHEME_QUEUE,
'allowPrivateMessages'=>false,
'lazySubscription'=>false,
'p2pDataMessaging'=>false
);


// this function will be called when chat need to be created


static private function createSession_chat($room, $sessionId){


// get account object
$account = self::init();


// real chat collection name
$collection = self::CHAT_NAME_TEMPLATE.$sessionId;


// create collection
$account->subscribeCollection($room, $collection);


// create config mod for "everyone" node
$historyEveryoneConfig = self::$CHAT_CONFIGURATION;
$historyEveryoneConfig['allowPrivateMessages'] = true;


// create "everyone" node
$account->createNode($room, $collection, self::CHAT_HISTORY_NODE_EVERYONE, $historyEveryoneConfig);


// create config mod for "participants" node


$historyParticipantsConfig = self::$CHAT_CONFIGURATION;
$historyParticipantsConfig['accessModel'] = self::ROLE_PUBLISHER;


// create "participants" node
$account->createNode($room, $collection, self::CHAT_HISTORY_NODE_PARTICIPANTS, $historyParticipantsConfig);


// create config mod for "hosts" node
$historyHostsConfig = self::$CHAT_CONFIGURATION;
$historyHostsConfig['accessModel'] = self::ROLE_OWNER;


// create "hosts" node
$account->createNode($room, $collection, self::CHAT_HISTORY_NODE_HOSTS, $historyHostsConfig);


// create config mod for "typing" node
$chatTypingConfig = self::$CHAT_CONFIGURATION;
$chatTypingConfig['userDependentItems'] = true;
$chatTypingConfig['sessionDependentItems'] = true;
$chatTypingConfig['itemStorageScheme'] = NodeConfiguration::STORAGE_SCHEME_MANUAL;


// create "typing" node


$account->createNode($room, $collection, self::CHAT_TYPING_NODE_NAME, $chatTypingConfig);
}


After code execution all chat nodes must be created and properly functioning.

Here is debug session for this code:

Strict Standards: Non-static method RTC::http_post() should not be called statically, assuming $this from incompatible context in Z:\home\localhost\www\***\php_project\lib\lccs.php on line 433
http_post: https://na2.collaboration.adobelivecycle.com:443/app/rtc &instance=na2-sdk-5551e168-e196-4843-8b7a-24c8da00e44e/fc_1&action=subscribe&collection=chat_18&gak=***

Strict Standards: Non-static method RTC::array_toXML() should not be called statically, assuming $this from incompatible context in Z:\home\localhost\www\***\php_project\lib\lccs.php on line 464

Strict Standards: Non-static method RTC::http_post() should not be called statically, assuming $this from incompatible context in Z:\home\localhost\www\***\php_project\lib\lccs.php on line 465
http_post: https://na2.collaboration.adobelivecycle.com:443/app/rtc?instance=na2-sdk-5551e168-e196-4843-8b7a-24... <request><configuration><field var="accessModel"><value type="int">10</value></field><field var="publishModel"><value type="int">10</value></field><field var="persistItems"><value type="boolean">true</value></field><field var="modifyAnyItem"><value type="boolean">false</value></field><field var="userDependentItems"><value type="boolean">false</value></field><field var="sessionDependentItems"><value type="boolean">false</value></field><field var="itemStorageScheme"><value type="int">1</value></field><field var="allowPrivateMessages"><value type="boolean">true</value></field><field var="lazySubscription"><value type="boolean">false</value></field><field var="p2pDataMessaging"><value type="boolean">false</value></field></configuration></request>

Array
(
    [Content-Type] => text/xml
)

Strict Standards: Non-static method RTC::array_toXML() should not be called statically, assuming $this from incompatible context in Z:\home\localhost\www\***\php_project\lib\lccs.php on line 464

Strict Standards: Non-static method RTC::http_post() should not be called statically, assuming $this from incompatible context in Z:\home\localhost\www\***\php_project\lib\lccs.php on line 465
http_post: https://na2.collaboration.adobelivecycle.com:443/app/rtc?instance=na2-sdk-5551e168-e196-4843-8b7a-24... <request><configuration><field var="accessModel"><value type="int">50</value></field><field var="publishModel"><value type="int">10</value></field><field var="persistItems"><value type="boolean">true</value></field><field var="modifyAnyItem"><value type="boolean">false</value></field><field var="userDependentItems"><value type="boolean">false</value></field><field var="sessionDependentItems"><value type="boolean">false</value></field><field var="itemStorageScheme"><value type="int">1</value></field><field var="allowPrivateMessages"><value type="boolean">false</value></field><field var="lazySubscription"><value type="boolean">false</value></field><field var="p2pDataMessaging"><value type="boolean">false</value></field></configuration></request>
Array
(
    [Content-Type] => text/xml
)

Strict Standards: Non-static method RTC::array_toXML() should not be called statically, assuming $this from incompatible context in Z:\home\localhost\www\***\php_project\lib\lccs.php on line 464

Strict Standards: Non-static method RTC::http_post() should not be called statically, assuming $this from incompatible context in Z:\home\localhost\www\***\php_project\lib\lccs.php on line 465
http_post: https://na2.collaboration.adobelivecycle.com:443/app/rtc?instance=na2-sdk-5551e168-e196-4843-8b7a-24... <request><configuration><field var="accessModel"><value type="int">100</value></field><field var="publishModel"><value type="int">10</value></field><field var="persistItems"><value type="boolean">true</value></field><field var="modifyAnyItem"><value type="boolean">false</value></field><field var="userDependentItems"><value type="boolean">false</value></field><field var="sessionDependentItems"><value type="boolean">false</value></field><field var="itemStorageScheme"><value type="int">1</value></field><field var="allowPrivateMessages"><value type="boolean">false</value></field><field var="lazySubscription"><value type="boolean">false</value></field><field var="p2pDataMessaging"><value type="boolean">false</value></field></configuration></request>

Array
(
    [Content-Type] => text/xml
)

Strict Standards: Non-static method RTC::array_toXML() should not be called statically, assuming $this from incompatible context in Z:\home\localhost\www\***\php_project\lib\lccs.php on line 464

Strict Standards: Non-static method RTC::http_post() should not be called statically, assuming $this from incompatible context in Z:\home\localhost\www\***\php_project\lib\lccs.php on line 465
http_post: https://na2.collaboration.adobelivecycle.com:443/app/rtc?instance=na2-sdk-5551e168-e196-4843-8b7a-24... <request><configuration><field var="accessModel"><value type="int">10</value></field><field var="publishModel"><value type="int">10</value></field><field var="persistItems"><value type="boolean">true</value></field><field var="modifyAnyItem"><value type="boolean">false</value></field><field var="userDependentItems"><value type="boolean">true</value></field><field var="sessionDependentItems"><value type="boolean">true</value></field><field var="itemStorageScheme"><value type="int">2</value></field><field var="allowPrivateMessages"><value type="boolean">false</value></field><field var="lazySubscription"><value type="boolean">false</value></field><field var="p2pDataMessaging"><value type="boolean">false</value></field></configuration></request>
Array
(
    [Content-Type] => text/xml
)

I've cut some info(key and local path) with "***" if you want this key(As i understand this is something like session key), i can send it to you privately.

So,

<field var="itemStorageScheme"><value type="int">1</value></field>

present, but chat_18/history node still SINGLE ITEM:

Capture.PNG

Avatar

Level 2

Can you say when exactly you planning to make a new release? I am asking because its very important to me make it working properly before of 4-th December(our application goes to final of a startup competition). Or it is my fault?

Avatar

Level 2

Hi!

Can anyone confirm this issue?

I've tested Whiteboard(nodes created with PHP) and faced the same problem. With it Whiteboard functioning like a diaster...

Avatar

Correct answer by
Employee

Well, I still am not sure of what the issue is.

I have tested your code and it works just fine for me. After running your "createSession_chat" on a newly created room, I call getNodeConfiguration on the new nodes and this is what I get:

--- EVERYONE ---------

http_get: https://na2.collaboration.adobelivecycle.com:443/app/rtc?path=/chat_1/nodes/history/configuration

<result>

<status code="ok"/>

<collections><node id="chat_1"><collection><nodes><node id="history"><collection><configuration><field var="publishModel"><value type="double">10.0</value></field><field var="allowPrivateMessages"><value type="boolean">true</value></field><field var="modifyAnyItem"><value type="boolean">false</value></field><field var="itemStorageScheme"><value type="double">1.0</value></field></configuration><items></items></collection></node></nodes></collection></node></collections>

</result>

--- PARTICIPANTS ---------

http_get: https://na2.collaboration.adobelivecycle.com:443/app/rtc?path=/chat_1/nodes/history_participants/con...

<result>

<status code="ok"/>

<collections><node id="chat_1"><collection><nodes><node id="history_participants"><collection><configuration><field var="publishModel"><value type="double">10.0</value></field><field var="accessModel"><value type="double">50.0</value></field><field var="modifyAnyItem"><value type="boolean">false</value></field><field var="itemStorageScheme"><value type="double">1.0</value></field></configuration><items></items></collection></node></nodes></collection></node></collections>

</result>

--- HOSTS ---------

http_get: https://na2.collaboration.adobelivecycle.com:443/app/rtc?path=/chat_1/nodes/history_hosts/configurat...

<result>

<status code="ok"/>

<collections><node id="chat_1"><collection><nodes><node id="history_hosts"><collection><configuration><field var="publishModel"><value type="double">10.0</value></field><field var="accessModel"><value type="double">100.0</value></field><field var="modifyAnyItem"><value type="boolean">false</value></field><field var="itemStorageScheme"><value type="double">1.0</value></field></configuration><items></items></collection></node></nodes></collection></node></collections>

</result>

--- TYPING ---------

http_get: https://na2.collaboration.adobelivecycle.com:443/app/rtc?path=/chat_1/nodes/typing/configuration

<result>

<status code="ok"/>

<collections><node id="chat_1"><collection><nodes><node id="typing"><collection><configuration><field var="userDependentItems"><value type="boolean">true</value></field><field var="publishModel"><value type="double">10.0</value></field><field var="modifyAnyItem"><value type="boolean">false</value></field><field var="itemStorageScheme"><value type="double">2.0</value></field><field var="sessionDependentItems"><value type="boolean">true</value></field></configuration><items></items></collection></node></nodes></collection></node></collections>

</result>

The values for itemStorageScheme matches the values you used when creating the nodes.

Not sure of what disaster is going on with the Whiteboard since all you showed us up to this point was related to chat nodes, and I guess I am not planning of making any changes to the PHP code since everything seems to be working as specified.

Avatar

Level 2

That's good news for me, thanks.

I'll try to clean up everything, switch accounts and will try again with this code.

With Whiteboard i've used the same approach, so if chat will work, i guess Whiteboard will work too.

Avatar

Level 2

Can you post complete code listing that you used to test this issue?

Ok, looks like i've figured out where is the problem. I've disabled CURL option and everything started to work properly. Please, check the same script that you have used, but now turn ON CURL:

RTC::$USE_CURL = true;