via

Simple pubsub server inspired by https://patchbay.pub/
git clone https://git.ce9e.org/via.git

commit
5d4551e662ca97c519d3e3cbdb8c2cae766b26be
parent
d5f6909fa5d5d913b417dc8ea92652b552e5f5e0
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2025-06-04 05:05
gofmt

Diffstat

M via.go 18 +++++++++---------

1 files changed, 9 insertions, 9 deletions


diff --git a/via.go b/via.go

@@ -21,17 +21,17 @@ import (
   21    21 )
   22    22 
   23    23 type Msg struct {
   24    -1 	Id int
   -1    24 	Id   int
   25    25 	Data []byte
   26    26 }
   27    27 
   28    28 type Topic struct {
   29    29 	sync.Mutex
   30    -1 	channels map[chan Msg]bool
   31    -1 	password string
   -1    30 	channels   map[chan Msg]bool
   -1    31 	password   string
   32    32 	hasHistory bool
   33    -1 	history []Msg
   34    -1 	lastId int
   -1    33 	history    []Msg
   -1    34 	lastId     int
   35    35 }
   36    36 
   37    37 var mux = &sync.RWMutex{}
@@ -146,11 +146,11 @@ func getTopic(key string, password string) (*Topic, bool) {
  146   146 
  147   147 	if !ok {
  148   148 		topic = &Topic{
  149    -1 			channels: make(map[chan Msg]bool, 0),
  150    -1 			password: password,
   -1   149 			channels:   make(map[chan Msg]bool, 0),
   -1   150 			password:   password,
  151   151 			hasHistory: strings.HasPrefix(key, "/hmsg/"),
  152    -1 			history: make([]Msg, 0),
  153    -1 			lastId: 0,
   -1   152 			history:    make([]Msg, 0),
   -1   153 			lastId:     0,
  154   154 		}
  155   155 		if topic.hasHistory {
  156   156 			topic.restoreHistory(key)