handle.clj

Branches > main > 70c3677 > files / src / net / bowmap / network / handle.clj

(ns net.bowmap.network.handle
  (:require
   [net.bowmap.network.packet :as pk]
   [net.bowmap.network.packets.serverbound :as serverbound]
   [net.bowmap.network.state :as state]))

; Handles incoming packets from clients

(defn handle-packet
  "Handles a severbound packet from a client"
  [client packet]
  (println packet)
  (case (::pk/id packet)
    ::serverbound/handshaking (assoc client ::state/connection-state (req! packet :intent))
    client))