How do I keep an Android P2P WEBRTC server from sleeping

Get help using Construct 2

Post » Tue Nov 10, 2015 2:03 am

Hi

I'm trying to put a P2P app together on Android using WebRTC. However, if the person acting as the server minimizes the app or leaves their device unattended for a while the device will go to sleep and everything breaks down (lost connections to the server etc -- which is understandable)

What is the best way, using C2, to have the acting server NOT sleep? I've seen things about the 'keep screen on' property and wake locks, however, how does one utilize those in C2? Ideally it would be something programmatic such that I would only ask the acting server to remain 'awake' while the other clients didn't have to....

Maybe a more overarching question is, do WevRTC apps play well with Android sleep and power optimization features? :S

And advice would be appreciated.

Thanks.

-Remy
B
71
S
14
G
1
Posts: 151
Reputation: 4,974

Post » Fri Nov 13, 2015 2:56 am

Any takers? Will this model of P2P in WebRTC even be able to be supported with Android features like Doze coming in Marshmallow? {deep sleeping}

OR, will people need to connect NodeJS or other server to communicate?
B
71
S
14
G
1
Posts: 151
Reputation: 4,974

Post » Tue Nov 17, 2015 4:19 am

Since this is probably a pretty niche question, perhaps I should ask you @ashley? :)
B
71
S
14
G
1
Posts: 151
Reputation: 4,974

Post » Tue Nov 17, 2015 8:27 am

This doesn't really seem to me to be a C2 related question.

As you say, it seems a little 'niche' to me also, although there may be one or two interested in any response, if there is anyone who even can :/

In the meantime, maybe a more appropriate place to ask such a question would be a proper Android dev forum?
If your vision so exceeds your ability, then look to something closer.
Moderator
B
131
S
29
G
81
Posts: 5,328
Reputation: 56,630

Post » Tue Nov 17, 2015 11:42 am

WebRTC hosts can keep themselves running on desktop OSs, but I think the Android OS puts the app to sleep when to focus away. I think that's entirely reasonable. It's a weird idea to run a persistent server on a battery-powered OS.
Scirra Founder
B
387
S
230
G
87
Posts: 24,248
Reputation: 192,238

Post » Wed Nov 18, 2015 2:53 am

Thanks for the responses @ashley and @zenox98... I didn't mean to imply that I'd want a mobile host to be a <b>persistent</b> server, but rather one <b>that persists shortly </b> (perhaps for a 10-15 minute game cycle? -- after that there wouldn't be any further server duty obligation)... It's not for even for a fast
twitchy multi-player game, more like a glorified version of the WebRTC chat-demo that comes with C2... If the host minimizes and time passes -- they take the party with them.

Perhaps the novelty of not requiring anything other than a signaling server was too good to be true in this mobile age we live in? :P

-Remy
B
71
S
14
G
1
Posts: 151
Reputation: 4,974

Post » Wed Nov 18, 2015 10:47 am

It'd still kill your battery. I think it's better to encourage people to use non-battery-powered systems to host.
Scirra Founder
B
387
S
230
G
87
Posts: 24,248
Reputation: 192,238


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests