cli: Monitor for conversation events also
This commit is contained in:
parent
623dccb26d
commit
c50b1f29d4
|
@ -44,6 +44,7 @@ func (c *Client) Initialize() error {
|
|||
// Spawn routines to query and monitor state changes
|
||||
go c.monitorNetwork()
|
||||
go c.monitorContacts()
|
||||
go c.monitorConversations()
|
||||
|
||||
// XXX block until populated/initialized?
|
||||
return nil
|
||||
|
@ -177,3 +178,25 @@ func (c *Client) monitorContacts() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) monitorConversations() {
|
||||
stream, err := c.Backend.MonitorConversations(context.Background(), &ricochet.MonitorConversationsRequest{})
|
||||
if err != nil {
|
||||
log.Printf("Initializing conversations monitor failed: %v", err)
|
||||
// XXX handle
|
||||
return
|
||||
}
|
||||
|
||||
log.Printf("Monitoring conversations")
|
||||
|
||||
for {
|
||||
event, err := stream.Recv()
|
||||
if err != nil {
|
||||
log.Printf("Conversations monitor error: %v", err)
|
||||
// XXX handle
|
||||
break
|
||||
}
|
||||
|
||||
log.Printf("Conversation event: %v", event)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue