server.clj

Branches > main > 55177a2 > files / src / net / bowmap / server.clj

(ns net.bowmap.server
  (:require
   [aleph.tcp :as tcp])
  (:import
   [io.netty.bootstrap ServerBootstrap]
   [io.netty.channel ChannelOption]))

(defn start-server!
  "Starts a TCP server at port 'port', calling 'handler' with each client, with TCP_NODELAY enabled."
  [& {:keys [handler port]}]
  (tcp/start-server handler
                    {:port port
                     :bootstrap-transform #(ServerBootstrap/.childOption % ChannelOption/TCP_NODELAY true)}))