Forum Multiplayer Online cluster Error SDK unity/c# v3.0.14 October 22nd 2014

Discussion and help relating to the PlayerIO Multiplayer API.

Online cluster Error SDK unity/c# v3.0.14 October 22nd 2014

Postby mouldi » October 30th, 2014, 1:06 am

Hi Player IO Community i appreciate if someone from the house answer me because i believe it's a player io bug !! but some help from a friend is always welcome . ok here is the problem

before updating to the latest version i used to get the callback when connecting to a running room (success callback), but i get neither failure callback nor the success one and i don't get a connection .
I believe this is a player io bug related to the latest release, because before updating everything was working fine, and the problem seems to manifest only when i deploy my servercode (dll) to the main cluster !!

if you are wondering about the code here feel free to ask me anything and thanks in advance .


using PlayerIOClient;
using System.Collections.Generic;
using UnityEngine;







public class PIO : ScriptableObject
{


private static PIO _instance;
public static PIO getInstance()
{
if (_instance == null)
{
Debug.Log("Construct PIO from static instance ");
_instance = new PIO();
}
return _instance;
}
//connection call back
public delegate void ConnectHandler(bool isConnected);
public event ConnectHandler onConnect;
//conencting params
private string _gameid = "blablabla-blablablabla";
private string _userid = null;
private Client _client = null;
private PlayerIOError _error = null;

//local dev server
public bool usedevserver = false;


//listing rooms params
private string _roomtype = null;
private Dictionary<string, string> _searchcriteria = null;
private int _resultlimit = 0;
private int _resultoffset = 0;
private PlayerIOClient.RoomInfo[] _roominfo = null;

//connecting to player io services
private Connection _connection = null;
private List<Message> msgList = new List<Message>(); // Messsage queue implementation
//connecting pio to a room for sending/reciving messages
//private Connection _roomconnection = null;
private RoomInfo[] _rooms = null;

//loading player object
private DatabaseObject _playerobj = null;


//service information status
private string infomsg = null;















//method for testing connection to playerio

public bool Connected { get; internal set; }

public enum _loadingstate
{
CONNECTING_TO_SERVICES = 0,
WAITING_FOR_INITIAL_PLAYER_DATA = 1,
CONNECTING_TO_SERVER = 2,
SAVING_DATA = 3,
LOADING_DATA = 4,
DONE = 5
};

public _loadingstate LoadingState = _loadingstate.CONNECTING_TO_SERVICES;

void Awake()
{
DontDestroyOnLoad(this);
}

//connecting to player io
public void Connect()
{

LoadingState = _loadingstate.CONNECTING_TO_SERVICES;
PlayerIO.QuickConnect.FacebookOAuthConnect(
_gameid, // Game id (Get your own at playerio.com. 1: Create user, 2:Goto admin pannel, 3:Create game, 4: Copy game id inside the "")
FB.AccessToken, // token
null, // partner
null, // playerinsight
delegate(Client c)
{
LoadingState = _loadingstate.WAITING_FOR_INITIAL_PLAYER_DATA;
_client = c;
_userid = _client.ConnectUserId;
infomsg = "pio client on line";

if (usedevserver)
{
_client.Multiplayer.DevelopmentServer = new ServerEndpoint("localhost", 8184);

}
ConnectToLobby();
},

delegate(PlayerIOError e)
{
_error = e;
infomsg = "pio client not connected";
});

PlayerIO.Connect(_gameid, "public", _userid, null, null, null,

delegate(Client c)
{

_client = c;

if (usedevserver)
{
_client.Multiplayer.DevelopmentServer = new ServerEndpoint("localhost", 8184);

}

},

delegate(PlayerIOError e)
{
_error = e;
});
}

//listing romms in Player io
public void ListRooms()
{
if (_client != null)
{
_client.Multiplayer.ListRooms(_roomtype, _searchcriteria, _resultlimit, _resultoffset,
delegate(PlayerIOClient.RoomInfo[] ri)
{
_roominfo = ri;
infomsg = "pio rooms lsited";
},
delegate(PlayerIOError e)
{
_error = e;
infomsg = "pio rooms not lsited";
}
);
}
}

public void ConnectToLobby()
{
if ((_client != null) && (_userid != null))
{

LoadingState = _loadingstate.CONNECTING_TO_SERVER;
_client.Multiplayer.CreateJoinRoom( null,
"Lobby", true,
new Dictionary<string, string> { },
new Dictionary<string, string> { },
delegate( Connection connection )
{
_connection = connection;
_connection.OnMessage += OnMessage;
Debug.Log( "Connected to Lobby from pio" );
infomsg = "pio connected to lobby";
onConnect(true);
LoadingState = _loadingstate.DONE;
Connected = true;
Debug.Log("this pio test true connection from Conencted =" + this.Connected);

},
delegate( PlayerIOError error )
{
onConnect(false);
Connected = false;
infomsg = "pio can't connect to lobby";
Debug.Log( "Failed to join room: " + error.Message );
} );







}
}

public void Send(string type, params object[] msg)
{
if(_connection != null)
{
Debug.Log("sending some data");
_connection.Send(type,msg);
}
}

private void OnMessage(object sender, Message e)
{
msgList.Add(e);
}
public void LoadPlayerData()
{
// load player object
_client.BigDB.LoadMyPlayerObject(
delegate(DatabaseObject playerObj)
{
LoadingState = _loadingstate.LOADING_DATA;
// store player object for later retrieval
_playerobj = playerObj;
},
delegate(PlayerIOError error)
{
infomsg = "pio can't load player data";
Debug.Log("Failed loading player object: " +
error.Message);
_error = error;
}
);

}

void Disconnect()
{

_connection.OnMessage -= OnMessage;
_connection.OnDisconnect -=connection_OnDisconnect;
}
void connection_OnDisconnect(object sender, string message)
{
Debug.Log("Disconnected from server");
_connection = null;
}
void SavePlayerData()
{
if(_playerobj != null)
{
LoadingState = _loadingstate.SAVING_DATA;
_playerobj.Save();
infomsg = "pio player data saved";
}
}
}

Thanks
mouldi
 
Posts: 23
Joined: December 28th, 2012, 2:02 am

Return to Multiplayer



cron