SocketCluster/socketcluster-client

Increases temperature on ios devices

RollinSafary opened this issue · 2 comments

Hi, i'm developing a game that is using socketcluster for connection to server. So ios devices are getting hot very quickly because of this. After turning off socket connections module in my game temperature become normal. So please check why is this happening and is there any way to fix it?

@RollinSafary What is the rate of messages on your client socket? If your client is sending and/or receiving a large number of messages per second and doing a lot of processing, then it can use up CPU which I guess could cause heating. I haven't heard about such issue before so I suspect it may be specific to your use case.

Note though that even highly optimized games like agar.io cause my laptop to overheat because they have a very high message rate.

The main situation is following:
I'm using cordova platform ios to build game for ios platform. Used game engine is Phaser 3, for socket connection is used socket-cluster.
Problem is that my app energy usage is in the end of energy usage "Very High" section. It means that with this usage increasing temperature is normal.
So I've done some tests to find out what does the most part of energy usage.
First test was running empty cordova project without any rendering and network connection. Result was near to no energy usage. So conclusion was that it's not cordova wrapper issue.
Second test: I've tried to run my game without socket connection. Opened one scene and made there multiple animations with hard calculations (but I haven't any scene in with such a load) in 60 fps rendering. So the energy usage was on the start of "Medium" section. Conclusion is that it's not rendering or calculations load.
Third test: I've run my game and still on menu scene. Which is static scene (without any animations). Energy usage was light.
Socket test below
The last test was just usage of socket cluster only for subscribing without getting and sending events.
Game scene is static view without any animations or actions.
So my socket client was sending just ping (every 3 secs) to server. But the energy usage was in the middle of "Very High" section. After entering to game play scene (i'm getting and sending 1 message in 6 second) I've energy usage in the end of "Very High" section.

The most strange part for me is, that even for old android devices socket cluster doesn't make so much energy usage. Tested device was nexus 4 and nexus 5.

The main conclusion is that something wrong in workflow of socket cluster for safari. Because on chrome webView it works just fine.
P.S. I've even deployed game on website and have opened it from safari browser and iPhone starts burning after minute.