1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-05-30 10:25:40 +02:00

Tests for cliet package

This commit is contained in:
Philipp Heckel 2021-12-22 23:20:43 +01:00
parent 6a7e9071b6
commit fe5734d9f0
8 changed files with 162 additions and 43 deletions
client

View file

@ -35,7 +35,7 @@ type Client struct {
}
// Message is a struct that represents a ntfy message
type Message struct {
type Message struct { // TODO combine with server.message
ID string
Event string
Time int64
@ -60,7 +60,7 @@ type subscription struct {
// New creates a new Client using a given Config
func New(config *Config) *Client {
return &Client{
Messages: make(chan *Message),
Messages: make(chan *Message, 50), // Allow reading a few messages
config: config,
subscriptions: make(map[string]*subscription),
}
@ -237,7 +237,9 @@ func performSubscribeRequest(ctx context.Context, msgChan chan *Message, topicUR
if err != nil {
return err
}
msgChan <- m
if m.Event == MessageEvent {
msgChan <- m
}
}
return nil
}