How to persist a websocket connection using ControlChannelTrigger in the background?

Anonymous
2020-02-22T05:21:15.96+00:00

Hello, I followed https://learn.microsoft.com/en-us/windows/uwp/networking/network-communications-in-the-background#controlchanneltrigger-with-websockets and create an out-of-process background task using ControlChannelTrigger with MessageWebSocket.

Everything works fine in the foreground, however, if I close the app window, the websocket connection will be killed and no longer receive any message.

I re-opened my app but found registered BackgroundTasks didn't exist any more and I had to register them again.

How can I persist a websocket connection using ControlChannelTrigger in the background?

Thanks!

Universal Windows Platform (UWP)
{count} votes