 ;; Copyright 2014 Red Hat, Inc, and individual contributors.
-;; 
+;;
 ;; Licensed under the Apache License, Version 2.0 (the "License");
 ;; you may not use this file except in compliance with the License.
 ;; You may obtain a copy of the License at
-;; 
+;;
 ;; http://www.apache.org/licenses/LICENSE-2.0
-;; 
+;;
 ;; Unless required by applicable law or agreed to in writing, software
 ;; distributed under the License is distributed on an "AS IS" BASIS,
 ;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

    :on-close   (fn [channel {:keys [code reason]}])
    :on-error   (fn [channel throwable])
    :fallback   (fn [request] (response ...))"
  [{:keys [on-message on-open on-close on-error fallback] :as args}]
  (undertow/create-websocket-handler args))

(defn create-servlet
  "The same callbacks accepted by create-handler are supported, where


  In addition, a :path may be specified. It will be resolved relative
  to the path on which the returned servlet is mounted"
  ([key value & key-values]
     (create-servlet (apply hash-map key value key-values)))
  ([{:keys [path on-message on-open on-close on-error fallback] :as args}]
     (javax/create-endpoint-servlet (javax/create-endpoint args) args)))
