Skip to main content


Indicates whether the target session is open or closed




Boolean — true if the amqpsession is open, otherwise false


Important Note Agent AMQP functionality is now deprecated and will shortly become unsupported. Any attempt to interact with imp API amqp objects and methods on unregistered development devices or on production devices will generate a runtime error.

If you are using or intend to use Azure IoTHub, we recommend you make use of MQTT instead of AMQP. Please see our Azure IoT Hub integration for more information.

This method is used to check whether the amqpsession object represents an open or a closed session. If the session is open, the call returns true. The call can be used check on the state of the session before executing code that depends on the session being open and will fail if it is not.


The following code shows how an open session is closed after a ten-minute delay by calling close() — after first checking that the session is still open by using isopen().


conn <- null;
session <- null;

function amqpConnectionManager(event, errorDetail) {
  // Received an event from the AMQP connection
  if (errorDetail) {
  } else {
    switch(event) {
      case "CONNECTION_OPEN":
        session = conn.opensession(amqpConnectionManager);

        // Close session after 10 minutes if it's not already
        imp.wakeup(600, function() {
          if (session.isopen()) {
            session = null;

// Initiate the connection
local url = "amqps://" + HUB_NAME + "";
conn = amqp.openconnection(url, amqpConnectionManager);