device.isconnected issue



  • Device ID is globally unique and stays the same, right?
    Device is currently OK and online.
    i can give you a URL that gives the status. (hint: it ends in ?status)
  • when is the major server update expected to be deployed.

    I am facing issues displaying the state of the imp on my demo website due to problems with isconnected function.
  • We're testing it with some users now. Depending on how this goes it'll roll out more widely in the coming weeks.

    In the meantime, you can work around the imp state by polling it (send a message from agent to imp, see if you get a reply within a timeout) - this should unblock your application in the meantime.
  • can you post a code snippet, that works.

    I tried to put the electric imp card offline, but httpsend command from agent immediately returns a zero.
  • You'd need to do something like this:

    On the device:
    agent.on("ping", function(v) { agent.send("pong", 0); });

    ...this will return a pong message the instant it sees a ping

    On the agent:

    const POLL_PERIOD = 10; // poll every 10 seconds
    last_response = 0; // timestamp of last response
    device.on("pong", function(v) { last_response = time(); });

    function polldevice() {
    imp.wakeup(POLL_PERIOD, polldevice);
    device.send("ping", 0);

    function is_device_connected() {
    // did we hear from device recently?
    if ((time() - last_response) < (POLL_PERIOD + 3)) return true;
    return false;
  • Again, my minor disconnect issue has popped up.
    it is happily reporting data, while device.isconnected() is false.
Sign In or Register to comment.