anchor.diff:                 (prog1 nil (handle-disconnect *reply* session-id)))))
         (handle-handshake scanner message-handler)))
   
  +;;; exported
   (defmacro define-socket.io-handler (message-handler &key (name 'socket.io) (prefix "/socket.io"))
     `(let ((scanner (create-scanner (concatenate 'string "^" ,prefix "/1(/.*)?")))) ; v1
        (define-easy-handler (,name :uri #'(lambda (request)
                                             (scan scanner (script-name request)))) ()
          (handle-socket.io-request (path-info*) scanner ,message-handler))))
  +
  +(defun define-socket.io-event-handler (event handler)
  +  (setf (event-handler event) handler))
  +
  +(defmacro socket.io-on (event args &body body)
  +  `(define-socket.io-event-handler ,event
  +       #'(lambda ,args
  +           ,@body)))
  
positive.code:                (handle-ack id (funcall message-handler (decode-json-from-string data)) data-ack))
                (:event
                 (log-message :debug "Client sent event message ~s" data)
                 (handle-ack id (funcall message-handler (decode-json-from-string data) t) data-ack))
                (:ack
                 (destructuring-bind (id data)
                     (coerce (nth-value 1 (scan-to-strings message-splitter data)) 'list)
  
negative.code:   (log-message :debug "Going to delete session ~a" (car session))
    (setq *sessions* (delete session *sessions* :test #'eq))
    (setq *websocket-handlers* (delete (getf-session session :dispatcher) *websocket-handlers* :test #'eq)))
  
  
  (defun event-handler (name)
    (cdr (assoc name *event-handlers* :test #'string=)))
  
  (defun (setf event-handler) (val var)
    (push (cons var val) *event-handlers*))
  
  
  (defun send-disconnect ()
    (websocket-send-message "0::"))
  