Answer the question
In order to leave comments, you need to log in
How to disable browser sleep (Wakelock API)?
A WebSocket connection has been established between the browser page (on a mobile phone) and the server. (using the socket.io library). There is always some kind of data on the connection (at least ping packets). When the phone goes to sleep, the browser disables the WebSocket connection.
Is it possible to somehow force the browser to "keep on" / "keep on" /... ?
Tried the library https://github.com/richtr/NoSleep.js - doesn't help. It still falls asleep and the connection is broken .... help pliz !!!
Answer the question
In order to leave comments, you need to log in
How do you call it?
Right now I'm making an interface in which I use nosleep.
Android does not fall asleep hanging in chrome.
It is necessary to call through a click otherwise the focus will not happen.
// Enable wake lock.
// (must be wrapped in a user input event handler eg a mouse or touch handler)
it is written in the dock for the weaklings))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question