Skip to content

Instantly share code, notes, and snippets.

@joshmarinacci
Created December 3, 2015 06:09
Show Gist options
  • Save joshmarinacci/f3075f4101eddc6b7393 to your computer and use it in GitHub Desktop.
Save joshmarinacci/f3075f4101eddc6b7393 to your computer and use it in GitHub Desktop.
protected override void OnStop()
{
try
{
eventLog.WriteEntry("Unsubscribe channel " + channel);
mrePubNub = new ManualResetEvent(false);
pubnub.Unsubscribe<string>(channel, UnsubscribeCallback, SubscribeMethodForConnectCallback, UnsubscribeMethodForDisconnectCallback, ErrorCallback);
mrePubNub.WaitOne(manualResetEventsWaitTimeout);
eventLog.WriteEntry("Channel " + channel + " unsubscribed.");
finalizeService = true;
}
catch (Exception erro)
{
eventLog.WriteEntry("Unsubscribe channel " + channel + "\r\n" + erro.Message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment