server2server integration and login/logout issues

Avatar

Avatar

Pablo_P_

Avatar

Pablo_P_

Pablo_P_

04-01-2012

Hi,

I'm using the recent php sdk to create a room and generate auth tokens.

Every time the user tries to login we run the following php code:

try {

    $rtc->createRoom($room, $template, true);

    $collection = 'UserManager';

    $rtc->subscribeCollection($room, $collection);

} catch (Exception $e) {

    // room already exists?

    log($e);

}

$session = $rtc->getSession($room);

$token = $session->getAuthenticationToken($secret, $userName, $userId, $userRole);

Transient room which prevents duplicate IDs:

  • A user can always login at the first time.
  • If the user logs out, waits more than 5 minutes and tries to login again, he always succeeds.
  • If the user logs out with cSession.logout() and tries to login again after less than 5 minutes it always fails.

        I'm getting the login event and the logout event immediately after that, both in the flash client and from the LCCS server2server hooks.

        In the php try/catch block I'm getting: exception 'RTCError' with message '403' in lccs.php:889

  • If the user tries to login again after less than 5 minutes he always succeeds.
  • I've tried to see if the room exists or not with the room console and $lccs->getRoomInfo($room) but I can't see a consistent behaviour.

        Sometimes the room is destroyed and sometimes not but the user still can't login after less than 5 minutes.

Non-transient room which allows duplicate IDs:

  • When a user logs out, the room sometimes disappears even though it is supposed to be a non-transient room.
  • The user is getting the login and right after that the logout event if trying to login again less than 5 minutes after the previous logout.

Any idea what could be wrong?

Thanks

View Entire Topic

Avatar

Avatar

Raff_

Employee

Avatar

Raff_

Employee

Raff_
Employee

04-01-2012

Not really sure of what you mean by "Non-transient room which allows duplicate IDs: When a user logs out, the room sometimes disappears". How do you know the room has disappeared ? Did you check in the Developer Portal and it's not there anymore ?

Regarding the 403, that's an authentication error. I am wondering if your authentication token (in AccountManager in the PHP code) becomes invalid.

Basically the authentication session on the server-side has an inactivity timeout of 15 minutes, so if you don't access our services for 15 minutes the authentication token expires and you'll start getting 403.

There are a couple of options here:

1) if you can set up an interval timer or cron-job like task (don't know if it's possible in PHP) you can "ping" our server every 10 minutes and keep the token alive.

2) if you get a 403 you should login again and retry the operation.