void EstablishNewConnection()
 {
     if (client != null)
     {
         Destroy(client.gameObject);
     }
     client = Instantiate(clientPrefab);
     client.OnMessageReceived = OnMessageReceived;
     client.OnDesconnected    = OnDesconnected;
     client.OnSubscribe       = OnSubscribe;
     client.Connect();
 }
Beispiel #2
0
        void Awake()
        {
            client = NetworkCore.Instance;
            client.Initialize();
            sessionKey = symmetricKey;

            keepList = new Dictionary <long, JSONObject>();

            client.OnMessageReceived += OnMessageReceived;
            client.OnDesconnected    += OnDesconnected;
            client.OnSubscribe       += OnSubscribe;
            client.OnCouldNotConnect += onCouldentConnect;
            pingTimer          = new System.Timers.Timer();
            pingTimer.Elapsed += OnPingTimerEvent;
            pingTimer.Interval = Sending_Ping_Intervel * 1000;
        }