initial commit
This commit is contained in:
15
event_stream.go
Normal file
15
event_stream.go
Normal file
@ -0,0 +1,15 @@
|
||||
package niri
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.tordarus.net/tordarus/channel"
|
||||
)
|
||||
|
||||
func (c *Client) SubscribeEvents(ctx context.Context) (<-chan Event, error) {
|
||||
ch, err := subscribeSocket[*eventContainer](ctx, c.GetSocketPath(), asJsonReader("EventStream"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return channel.MapSuccessive(ch, (*eventContainer).event), nil
|
||||
}
|
Reference in New Issue
Block a user