void Update() { if (_listenForMessages == true) { _listener.ListenForMessages(); } }
/// <summary> /// receive an event targeted to this particular player /// </summary> /// <param name="post"></param> static void ListenForMessages() { _isRunning = true; var listener = new ServiceBusListener(); while (_shouldRun) { try { listener.ListenForMessages(); } catch (WebException ex) { // if the server has not created a topic yet for the client then a 404 error will be returned so do not report if (!ex.Message.Contains("The remote server returned an error: (404) Not Found")) { if (OnListenError != null) { OnListenError.Invoke(null, new ErrorEventArgs(ex)); } } } catch (Exception ex) { if (OnListenError != null) { OnListenError.Invoke(null, new ErrorEventArgs(ex)); } } } _isRunning = false; }