Forum BigDB Refreshing connection with new user/permissions

Discussion and help relating to the PlayerIO database solution, BigDB.

Refreshing connection with new user/permissions

Postby actionsprite » July 9th, 2010, 8:16 am

I'm creating a restricted client/connection named "guest" with PlayerIO via PLayerIO.connect() when an anonymous player first loads the swf- it then uses this connection to display some global and public stats about the game.

If the player then logs into facebook I am trying to re-establish a new client/connection named "public" with the known user (which has save/create permissions). However when I try this I get an error saying that the current connection is still "guest" and prevents me from writing to BigDB because of the permissions restrictions.

Is it possible to refresh/recreate a client/connection to PlayerIO in this way?

my code looks something like this:
Code: Select all
public var client:Client
public function connect(thisUserId:String = "guest"):void {
   var myConnection:String = thisUserId =="guest"?"guest":"public"
   PlayerIO.connect(stage,GAME_ID,myConnection,thisUserId,"", connectResponse)
protected function connectResponse(thisClient:Client):void{
   trace('connected'); // connection established
   client = thisClient

I call the same function to create both the guest and public connections.

Posts: 21
Joined: June 26th, 2010, 1:01 am

Re: Refreshing connection with new user/permissions

Postby Benjaminsen » July 9th, 2010, 12:39 pm


Did you secure that your connection Public have the proper access rights to the data you are trying to load?
I created the below test to see if there where a bug in our system, but it works as expected. Namely that save fails when clicking "save user data" before being connected to facebook.


(This is a fork of the facebook connect example.)

On init, the file connects using the connection "public" with the following settings:

When you press connect to Facebook it reconnects using quickconnects facebookConnectPopup. Quick connect is configured to use the connection "secure"

The connection secure is configured as follows

Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Refreshing connection with new user/permissions

Postby actionsprite » July 11th, 2010, 1:36 am

Hi Chris,
I was storing a reference to the DatabaseObject from the original anonymous connection and then trying to use that to make save/edit changes once the facebook log in had taken effect.

I hadn't realised that the DatabaseObject would maintain it's connection/permissions settings - but that makes sense. Now I am just grabbing a new reference to the object from the server after facebook authorisation and it's working fine.

Posts: 21
Joined: June 26th, 2010, 1:01 am

Return to BigDB