message.clj

Branches > main > 869040e > files / src / net / bowmap / network / protocol / message.clj

(ns net.bowmap.network.protocol.message
  (:require
   [clojure.alpha.spec :as s]
   [dev.grahp.spec :as S]))

(S/def ::id
  "The id of a message. See the serverbound and clientbound packet definitions for the names."
  qualified-keyword?)

(S/def ::numeric-id
  "Protocol id of a packet, i.e. 0x00, 0x80, etc.
   Numeric ids are NOT unique across connection states! See the wiki"
  pos-int?)

(S/def ::message
  "Represents a logical message map (object) from client to/from server.
   'Packet' is used to refer to a serialized message"
  (s/schema [::id]))