Published an OpportunityMarksUpdated event when an opportunity's marks change over the API
This commit is contained in:
1 parent
70d62f280e
commit
848edc73e2
7 files changed
+203
-34
No files matched your search
@@ -136,6 +136,11 @@ set, the API serves the stored opportunities under /api/opportunities.`,
|
||||
)
|
||||
}
|
||||
|
||||
// Events from the sources and the API, such as new opportunities and
|
||||
// changed marks, are pushed to every WebSocket client.
|
||||
var bus events.Bus
|
||||
options = append(options, server.WithEvents(&bus))
|
||||
|
||||
appServer, err := server.New(&conf.Server, options...)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -146,12 +151,6 @@ set, the API serves the stored opportunities under /api/opportunities.`,
|
||||
runCtx, cancelRun := context.WithCancel(ctx)
|
||||
defer cancelRun()
|
||||
|
||||
// Events from the sources, such as new opportunities, are pushed to
|
||||
// every WebSocket client.
|
||||
var bus events.Bus
|
||||
bus.Subscribe(func(event events.Event) {
|
||||
appServer.PushEvent(event.Type, event.Payload)
|
||||
})
|
||||
fetcherOptions = append(fetcherOptions, fetcher.WithEvents(&bus))
|
||||
|
||||
sourceFetcher := fetcher.New(&conf.Sources, fetcherOptions...)
|
||||
|
||||
Reference in new issue
Block a user