File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -809,6 +809,29 @@ func (c *RoomClient) handleSev(msg []string) error {
809809 return nil
810810}
811811
812+ const (
813+ animStart = iota
814+ animStop
815+ )
816+
817+ func (c * RoomClient ) handleAnc (msg []string ) error {
818+ if len (msg ) != 2 {
819+ return errors .New ("segment count mismatch" )
820+ }
821+
822+ cmd , err := strconv .Atoi (msg [1 ])
823+ if err != nil {
824+ return err
825+ }
826+ if cmd > animStop || cmd < animStart {
827+ return errors .New ("invalid command" )
828+ }
829+
830+ c .broadcast (buildMsg ("anc" , cmd ))
831+
832+ return nil
833+ }
834+
812835// SESSION
813836
814837func (c * SessionClient ) handleI () error {
Original file line number Diff line number Diff line change @@ -295,6 +295,8 @@ func (c *RoomClient) processMsg(msgStr string) (err error) {
295295 err = c .handleSv (msgFields )
296296 case "sev" :
297297 err = c .handleSev (msgFields )
298+ case "anc" :
299+ err = c .handleAnc (msgFields )
298300 default :
299301 err = errors .New ("unknown message type" )
300302 }
You can’t perform that action at this time.
0 commit comments