Reputation: 1075
I'm implementing a Node application using Electron that communicates with a websocket server. The app runs smoothly as long as the user is logged in. If the user is inactive for some time, the lock screen of the Windows 10 system shows up. The websocket connection then seems to be stopped as long as the user unlocks the desktop.
Is there any chance to have the websocket connection open and running also if the client is in lock screen?
Maybe there is a solution for not letting the System lock the screen through node?
Upvotes: 2
Views: 1597
Reputation: 1075
found solution by myself:
electron offers powerSaveBlocker class
example:
const { powerSaveBlocker } = require('electron')
const id = powerSaveBlocker.start('prevent-display-sleep')
console.log(powerSaveBlocker.isStarted(id))
powerSaveBlocker.stop(id)
More details can be found at the official api documentation:
https://electronjs.org/docs/api/power-save-blocker
Upvotes: 1