docs: function open() {
              // If there is no remaining URI, fires `error` and `close` event as
              // it means that all connection failed.
              if (uris.length === 0) {
                  self.emit("error", new Error());
                  self.emit("close");
                  return;
              }
              // Removes the first element and returns it. For example,
              // `[1,2].shift()` returns `1` and make the array `[2]`.
              var uri = uris.shift();
              // Because transport can handle only the specific URI, URI
              // determines transport. It finds which transport can handle this
              // `uri` among transports specified by `transports` option.
              for (var i = 0; i < options.transports.length; i++) {
                  // Each transport factory checks if the given URI can be handled
                  // and creates and returns transport object if so and returns
                  // nothing if not.
                  trans = options.transports[i](uri, options);
                  // If factory creates a transport,
                  if (trans) {
                      // it establishes a connection.
                      trans.open();
                      // If it fails, it tries with next URI or other transport.
                      trans.on("close", open);
                      // If it succeeds, a process to find working transport is
                      // terminated. At the socket level, the first message is
                      // used to handshake the protocol. `once` registers one-time
                      // event handler.
                      trans.once("text", function(text) {
                          // The handshake output is in the form of URI and uses
                          // query part to get/set header.
                          var result = url.parse(text, true).query;
                          // To maintain alive connection, heartbeat is used.
                          options.heartbeat = +result.heartbeat;
                          // `_heartbeat` is usually for testing so it may be not
                          // passed from the server. The default value is `5000`.
                          options._heartbeat = +result._heartbeat || 5000;
                          // Now that the working transport is found and
                          // handshaking is completed, removes `close`
                          // event's `open` handler which is used to find working
                          // transport,
                          trans.removeListener("close", open);
                          // initializes the transport
                          init(trans);
                          // and fires `open` event which is the first event user
                          // can handle socket.
                          self.emit("open");
                      });
                      break;
                  }
              }
          }