Skip to content

Commit

Permalink
feat: add raw subscriber
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangliang committed Nov 11, 2022
1 parent 1e07081 commit f26bbb7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/agent/subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,15 @@ func NewGqlSubscriber(name string, query interface{}) *GqlSubscriber {
}
return subscriber
}

func NewGqlRawSubscriber(name, query string) *GqlSubscriber {
subscriber := &GqlSubscriber{}
subscriber.SubTopic = func(ticker core.Ticker, client interface{}) error {
tick := ticker.(*Tick)
subClient := client.(*graphql.SubscriptionClient)
wrapHandler := subscriber.GqlSubscriberWrapHandler(name, tick)
_, err := subClient.SubscribeRaw(query, subscriber.variables, wrapHandler)
return err
}
return subscriber
}

0 comments on commit f26bbb7

Please sign in to comment.