Expand my Community achievements bar.

SOLVED

Editing Room Settings from the Server

Avatar

Level 2

Hi guys-

I'm trying to figure out how to change the room settings from my server, rather than from the client side with owner privileges. The use case is pretty simple: A user pre-schedules a room with a certain expiry period/timeout, and then once the session begins the room cuts out automatically when that time (plus a small graceperiod) have expired.

At the moment I'm doing this via client enforcement- basically a client calls out to my own service to get the current server timestamp and the expiry timestamp, and then sets up a second timer to sync this data every five minutes so a client can't futz with the settings by changing their system clock. Optimally, however, I'd like this to be strictly enforced by the LCCS room itself by managing the room timeout when the room is created.

Is there any way to accomplish this? The documentation's a little sparse on how to change room settings from the server libs.

Michael Krotscheck

1 Accepted Solution

Avatar

Correct answer by
Employee

This code actually works for me:

     $messageItem = array("nodeName"=>"roomAccess","itemID"=>"timeOut","body"=>3600);

     $result = $rtcAccount->publishItem($roomID, "RoomManager", "roomAccess", $messageItem );

What version of the script are you using ? Can you enabled debugging ? Add the following line to your script:

     RTC::$DEBUG = true;

View solution in original post

4 Replies

Avatar

Employee

You should be able to do so but using the publishItem method and "publishing" your timeout value to the RoomManager accesSettings node:

I don't know what language you work with but this is what you would do in Ruby:

#

# Get an instance of account manager

#

am = LCCS::AccountManager.new("your-account-url")

am.login(login, password)

#

# Create new room

#

am.createRoom("newroom")

#

# Change room timeout

#

item = {
        'body' => roomTimeoutValue
        }
}
am.publishItem("newroom", "RoomManager", "roomAccess", item)

the room timeout value is in seconds

Avatar

Level 2

Thanks for the pointer at the roomAccess node. Is there any particular location where all the default collections and node names are documented? I wasn't able to find "RoomManager" and "roomAccess" anywhere in the documentation or on Google.

Having said that, I'm still having what I suppose is a syntax error. My code (PHP) is below, and from the error message it seems like I don't have all the necessary pieces attached to the publishing item, and/or I need to structure it a little differently. Is there definitive documentation somewhere on how these requests need to be structured?

// This works

$rtcAccount->createRoom($roomName, $template);

$item = array();

$item['itemID'] = 'timeOut';

$item['nodeName'] = "roomAccess";

$item['body'] = 60*60; // Test with one hour.

$item['timestamp'] = time();

// This works

$readResult = rtcAccount->fetchItems($roomName, "RoomManager", "roomAccess");

// This does not, returns <result><status code="error" subcode="missing-items"/></result>

$publishResult = $rtcAccount->publishItem($roomName, "RoomManager", "roomAccess", $item );

Avatar

Correct answer by
Employee

This code actually works for me:

     $messageItem = array("nodeName"=>"roomAccess","itemID"=>"timeOut","body"=>3600);

     $result = $rtcAccount->publishItem($roomID, "RoomManager", "roomAccess", $messageItem );

What version of the script are you using ? Can you enabled debugging ? Add the following line to your script:

     RTC::$DEBUG = true;

Avatar

Level 2

Odd- after stripping out the additional parameters that I had attached to the message it started working. Thanks for looking into this for me