Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electron session end after every 30 seconds #291

Open
sohil4932 opened this issue Feb 12, 2019 · 5 comments
Open

Electron session end after every 30 seconds #291

sohil4932 opened this issue Feb 12, 2019 · 5 comments

Comments

@sohil4932
Copy link

sohil4932 commented Feb 12, 2019

We are able to connect Electron with Local spark-server over TCP protocol. But it re-connect at every 30 seconds. following are logs from spark-server.

2|start | [2019-02-12T05:54:10.097Z] INFO: DeviceServer.js/7346 on ip-172-31-1-96: New Connection
2|start | Connection attributes { particleProductId: 10,
2|start | platformId: 10,
2|start | productFirmwareVersion: 65535,
2|start | reservedFlags: 2 }
2|start | [2019-02-12T05:54:13.156Z] INFO: DeviceServer.js/7346 on ip-172-31-1-96: Connection (connectionID=151, deviceID=220030000e51353433323633, remoteIPAddress=::ffff:106.78.173.133)
2|start | [2019-02-12T05:54:16.476Z] INFO: Device.js/7346 on ip-172-31-1-96: On device protocol initialization complete (cache_key=_151, deviceID=220030000e51353433323633, firmwareVersion=65535, ip=::ffff:106.78.173.133, particleProductId=10, platformId=10)
2|start | [2019-02-12T05:54:16.478Z] INFO: DeviceServer.js/7346 on ip-172-31-1-96: Subscribe Request (deviceID=220030000e51353433323633, isFromMyDevices=false, messageName=spark)
2|start | [2019-02-12T05:54:18.356Z] INFO: DeviceServer.js/7346 on ip-172-31-1-96: Connected Devices (devices=1, sockets=1)
2|start | [2019-02-12T05:54:28.365Z] INFO: DeviceServer.js/7346 on ip-172-31-1-96: Connected Devices (devices=1, sockets=1)
2|start | [2019-02-12T05:54:38.367Z] INFO: DeviceServer.js/7346 on ip-172-31-1-96: Connected Devices (devices=1, sockets=1)
2|start | [2019-02-12T05:54:47.483Z] ERROR: Device.js/7346 on ip-172-31-1-96: Device disconnected (disconnectCounter=1, message="socket timeout")
2|start | logInfo: {
2|start | "cache_key": "_151",
2|start | "deviceID": "220030000e51353433323633",
2|start | "duration": 34.326
2|start | }
2|start | [2019-02-12T05:54:47.488Z] WARN: DeviceServer.js/7346 on ip-172-31-1-96: Session ended for Device (connectionKey=_151, deviceID=220030000e51353433323633)
2|start | [2019-02-12T05:54:48.369Z] INFO: DeviceServer.js/7346 on ip-172-31-1-96: Connected Devices (devices=0, sockets=0)
2|start | [2019-02-12T05:54:49.585Z] INFO: DeviceServer.js/7346 on ip-172-31-1-96: New Connection

@jlkalberer
Copy link

@sohil4932 - can you try flashing your electron with a v0.6.3 system firmware and see how that goes?

I am guessing that the electron is going into "low power mode" which has a newer way to reconnect to the server. This would be the same with the Argon and Boron.

@Sarveshwar20
Copy link

The reason it reconnects after every 30 seconds is because in 'settings.js' timeout value is set to 30 seconds. So before data is received the timer value resets and connection is re-established. Increase the value and rebuild CLI and try again. You can also edit this in your own firmware. It should work.

@jlkalberer
Copy link

Ahh.. that makes sense. Do you know what the standard timeout for electron is on the hardware-side?

It might make sense to allow the setting to be configurable per device type.

@Sarveshwar20
Copy link

@jlkalberer The timeout duration varies by mobile network operator. The default timeout is set to 23 minutes. However, when using third party SIM cards, timeout value needs to be set manually depending on the carrier.

@jlkalberer
Copy link

Got it. I see they have a keepalive function here - https://docs.particle.io/reference/device-os/firmware/electron/
I would hope that it would ping the server with that value so we can store it and use it as the keepalive.

If it's not doing that, it would make sense to just check if the device is an electron and use 23 minutes instead of 30 seconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants