moved socket.Emit("registerSensor"...) into a new function, so it can be called whenever server disconnects then reconnects