           # If the URL is empty, nothing to do.
           return unless url
 
+          # Parse the URL.
+          url = parseUrl url
+
+          isSecure = url.protocol is 'https:' or url.protocol is 'wss:'
+
           # Creates the new RFB object.
           rfb = new $window.RFB {
             # Options.
-            encrypt: false
+            encrypt: isSecure
             # local_cursor: true
             target: $element[0]
             wsProtocols: ['chat']

            onUpdateState: (args...) -> console.log args
          }

          # Parse the URL.
          url = parseUrl url

          path = url.path
          # Leading '/' is added by noVNC.
          if path[0] is '/'

          # Connects.
          rfb.connect(
            url.hostname
            url.port || (if isSecure then 443 else 80)
            '' # TODO: comment.
            path
          )
