The invention relates to the technical field of
Internet of Things communication, discloses an
Internet of Things multi-Android
client state synchronization method, and solves the problems of poor
state consistency, high back-end dependence, large
delay and insufficient compatibility in the prior art. According to the scheme, the method comprises the steps that after a
client completes initialization,
MQTT connection with a rear end is established, an
MQTT state message pushed by the rear end is monitored, after the message is received,
equipment state information is obtained through analysis, local state cache and a UI interface are updated, meanwhile, the
client serves as a distribution node, a UDP synchronization message containing the
equipment state and the IP of the distribution node is established, and the UDP synchronization message is sent to the client. The UDP synchronization message is broadcasted to the
local area network, other clients in the
local area network receive the UDP synchronization message and then verify whether the distribution node IP is the client in the
local area network, if the
verification is passed, the message is analyzed, the state updating
timestamp and the local cache
timestamp are compared, and the local state cache and the UI interface are updated only when the state updating
timestamp is larger.