mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-06-12 15:43:23 +02:00
Subscribe endpoint consolidation; same behavior for all endpoints; keepalive
This commit is contained in:
parent
b72afb1695
commit
a38aca47bd
8 changed files with 154 additions and 93 deletions
server
|
@ -21,15 +21,10 @@ type topic struct {
|
|||
mu sync.Mutex
|
||||
}
|
||||
|
||||
// message represents a message published to a topic
|
||||
type message struct {
|
||||
Time int64 `json:"time"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// subscriber is a function that is called for every new message on a topic
|
||||
type subscriber func(msg *message) error
|
||||
|
||||
// newTopic creates a new topic
|
||||
func newTopic(id string) *topic {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
return &topic{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue