public string On(string eventName, EventCallback callback) { // Debug.Log("Network.on...\n\neventName: " + eventName); try { var events = _eventCallback[eventName]; if (events != null) { var id = Guid.NewGuid().ToString(); events.Add(id, callback); if (eventName.Equals("connect") && _connectionState) { Debug.Log("eventName.Equals(\"connect\")"); var data = new JSONObject(); data.Add("peerId", _peerId); callback.OnFire(data); } if (eventName.Equals("open") && _isSocketOpen) { Debug.Log("eventName == open && isSocketOpen"); var data = new JSONObject(); callback.OnFire(data); } return(id); } } catch (Exception e) { Debug.LogError("Exception: " + e.Message); //throw new ServiceException(e); } return(null); }