              (equal (emdocs-get-process client) sock))
            *emdocs-outgoing-clients*))))
 
-(defun emdocs-client-filter (buffer sock msg)
+(defun emdocs-client-filter (client sock msg)
   "docstring"
   ;; assumes will only receive json from emdocs-after-change-function
-  (with-current-buffer (emdocs-get-client-process-buffer buffer)
+  (with-current-buffer (emdocs-get-attached-buffer buffer)
     (goto-char (point-min))
     (insert "filter:" msg)
     (unless (bolp) (newline)))
   (if (string-match "^give me buffer and ip\n$" msg)
       (process-send-string
        sock
-       (json-encode
-        `(:buffer ,(if (bufferp buffer)
-                       (buffer-name buffer)
-                     buffer)
-          :ip ,(emdocs-get-internal-ip-address))))
+       (concat
+        (json-encode
+         `(:buffer ,(if (bufferp buffer)
+                        (buffer-name buffer)
+                      buffer)
+           :ip ,(emdocs-get-internal-ip-address)))
+        "\n"))
     (let* ((json-object-type 'plist)
            (json-msg (json-read-from-string msg))
            (buffer (plist-get json-msg :buffer))

    :accessor emdocs-get-ip
    :documentation "docstring"))
  "docstring")

;;; functions


(defun emdocs-emit-keypress-json (buffer type point content)
  "docstring"
  (emdocs-broadcast-message
   (concat
    (json-encode
     `(:buffer ,(if (bufferp buffer)
                    (buffer-name buffer)
                  buffer)
       :edit_type ,type
       :point ,point
       :content ,content))
    "\n")))

(defun emdocs-after-change-function (buffer beg end prev-length)
  "docstring"
