Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (_epiSimSocket != null)
        {
            string epiSimUrl = string.Format("{0}:{1}", _epiSimSocket.address, _epiSimSocket.port);
            if (_epiSimSocket.isConnected)
            {
                if (commBridge.tryAgainSockets.ContainsKey(epiSimUrl))
                {
                    if (commBridge.tryAgainSockets[epiSimUrl] == typeof(FusionSocket))
                    {
                        _epiSimSocket = (EpistemicState)commBridge.FindRestClientByLabel("EpiSim");
                        //Debug.Log(_fusionSocket.IsConnected());
                    }
                }

                //string inputFromFusion = _fusionSocket.GetMessage();
                //if (inputFromFusion != "") {
                //    Debug.Log(inputFromFusion);
                //    Debug.Log(_fusionSocket.HowManyLeft() + " messages left.");
                //    _fusionSocket.OnFusionReceived(this, new FusionEventArgs(inputFromFusion));
                //}
            }
            else
            {
                //SocketConnection _retry = socketConnections.FirstOrDefault(s => s.GetType() == typeof(FusionSocket));
                //TryReconnectSocket(_fusionSocket.Address, _fusionSocket.Port, typeof(FusionSocket), ref _retry);
                //_fusionSocket.OnConnectionLost(this, null);
                if (!commBridge.tryAgainRest.ContainsKey(epiSimUrl))
                {
                    commBridge.tryAgainRest.Add(epiSimUrl, _epiSimSocket.GetType());
                }
            }
        }
    }