   (loop for client in *emdocs-incoming-clients*
         do (when (emdocs-test-if-client-attached-to-buffer client)
              (delete-process (emdocs-get-process client))))
-  (setq *emdocs-incoming-clients*
+  (setq *emdocs-incoming-clientbuffer
         (remove-if #'emdocs-test-if-client-attached-to-buffer
                    *emdocs-incoming-clients*))
   (setq-local after-change-functions

            (define-key map (kbd "C-c C-c") 'emdocs-mode)
            map)
  (if emdocs-mode
      (emdocs-connect)
    (emdocs-disconnect)))

(provide 'emdocs-mode)

                 (emdocs-emit-keypress-json
                  buffer "delete" beg prev-length)))))))

(defun emdocs-broadcast-buffer-at-intervals (buffer)
  "docstring"
  (with-current-buffer buffer
    (when emdocs-mode
      (emdocs-broadcast-message
       (json-encode `(:buffer ,buffer
                      :buffer_contents ,(buffer-string))))
      (run-at-time "1 min" nil #'emdocs-broadcast-buffer-at-intervals buffer))))

(defun emdocs-attach-to-buffer (buffer ip)
  "docstring"
  (let ((my-ip (emdocs-get-internal-ip-address)))
    (if my-ip
