Skip to content

Instantly share code, notes, and snippets.

@MagnusThor
Created January 21, 2016 08:06
Show Gist options
  • Save MagnusThor/34cee223568e74ee1b81 to your computer and use it in GitHub Desktop.
Save MagnusThor/34cee223568e74ee1b81 to your computer and use it in GitHub Desktop.
Keep alive using System.Timers.Timer();
public override async Task OnOpened() {
var t = new System.Timers.Timer();
// do your onOpen Stuff...
t.Interval = 1000 * 15;
t.Elapsed += (sender, args) => {
this.Invoke(new {
ts = DateTime.Now.Second
}, "ping");
};
t.Start();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment