Closed AntonPuko closed 7 years ago
When we connect a device for the first time, handshake automatically save public key. then _onDeviceReady invoked. It should save deviceAttribues if they don't exist (https://github.com/Brewskey/spark-protocol/blob/dev/src/server/DeviceServer.js#L254-L281) ...but since the operation takes some time, this error: https://github.com/Brewskey/spark-protocol/blob/dev/src/server/DeviceServer.js#L332 is caught before.
I guess we can't delay devices events, so the only fix I see for this is: get rid of autosaving publicKey on handshake: https://github.com/Brewskey/spark-protocol/blob/dev/src/lib/Handshake.js#L300-L305
If the device's key isn't there then we should probably just ignore any events it's sending
When we connect a device for the first time, handshake automatically save public key. then _onDeviceReady invoked. It should save deviceAttribues if they don't exist (https://github.com/Brewskey/spark-protocol/blob/dev/src/server/DeviceServer.js#L254-L281) ...but since the operation takes some time, this error: https://github.com/Brewskey/spark-protocol/blob/dev/src/server/DeviceServer.js#L332 is caught before.
I guess we can't delay devices events, so the only fix I see for this is: get rid of autosaving publicKey on handshake: https://github.com/Brewskey/spark-protocol/blob/dev/src/lib/Handshake.js#L300-L305