@@ -26,32 +26,32 @@ type GraphqlSubscriptionClient struct {
2626 connected bool
2727}
2828
29- func NewGraphqlQueryClient (host string , token string ) GraphqlClient {
29+ func NewGraphqlQueryClient (host string , token string ) * GraphqlClient {
3030 transport := http .DefaultTransport
3131 if token != "" {
3232 transport = database.AuthHeaderTransport {Transport : http .DefaultTransport , Token : token }
3333 }
3434
3535 customHttpClient := http.Client {Transport : transport }
36- return GraphqlClient {
36+ return & GraphqlClient {
3737 Host : host ,
3838 Client : graphql .NewClient (host , & customHttpClient ),
3939 }
4040}
4141
42- func (c GraphqlClient ) Connect () error {
42+ func (c * GraphqlClient ) Connect () error {
4343 return nil
4444}
4545
46- func NewGraphqlSubscriptionClient (host string , token string ) (error , GraphqlSubscriptionClient ) {
46+ func NewGraphqlSubscriptionClient (host string , token string ) (error , * GraphqlSubscriptionClient ) {
4747 client := graphql .NewSubscriptionClient (host ).
4848 WithConnectionParams (map [string ]interface {}{
4949 "headers" : map [string ]string {
5050 "x-hasura-admin-secret" : token ,
5151 },
5252 }).OnError (onClientError )
5353
54- subClient := GraphqlSubscriptionClient {
54+ subClient := & GraphqlSubscriptionClient {
5555 Client : client ,
5656 errChan : make (chan error ),
5757 readyChan : make (chan bool ),
@@ -64,13 +64,13 @@ func NewGraphqlSubscriptionClient(host string, token string) (error, GraphqlSubs
6464 return nil , subClient
6565}
6666
67- func (c GraphqlSubscriptionClient ) onClientConnected () {
67+ func (c * GraphqlSubscriptionClient ) onClientConnected () {
6868 zap .S ().Infof ("Graphql client connected" )
6969 c .connected = true
7070 c .readyChan <- true
7171}
7272
73- func (c GraphqlSubscriptionClient ) onClientDisconnected () {
73+ func (c * GraphqlSubscriptionClient ) onClientDisconnected () {
7474 zap .S ().Warnf ("Graphql client disconnected" )
7575 c .connected = false
7676 c .readyChan <- false
@@ -81,7 +81,7 @@ func onClientError(sc *graphql.SubscriptionClient, err error) error {
8181 return err
8282}
8383
84- func (c GraphqlSubscriptionClient ) Subscribe (query interface {}, handler func (message * json.RawMessage , err error ) error ) error {
84+ func (c * GraphqlSubscriptionClient ) Subscribe (query interface {}, handler func (message * json.RawMessage , err error ) error ) error {
8585 id , err := c .Client .Subscribe (query , nil , handler )
8686 if err != nil {
8787 return err
@@ -90,15 +90,15 @@ func (c GraphqlSubscriptionClient) Subscribe(query interface{}, handler func(mes
9090 return nil
9191}
9292
93- func (c GraphqlSubscriptionClient ) Unsubscribe () error {
93+ func (c * GraphqlSubscriptionClient ) Unsubscribe () error {
9494 err := c .Client .Unsubscribe (c .Id )
9595 if err != nil {
9696 return err
9797 }
9898 return nil
9999}
100100
101- func (c GraphqlSubscriptionClient ) Start () error {
101+ func (c * GraphqlSubscriptionClient ) Start () error {
102102 go func () {
103103 err := c .Client .Run ()
104104 if err != nil {
@@ -118,10 +118,10 @@ func (c GraphqlSubscriptionClient) Start() error {
118118 }
119119}
120120
121- func (c GraphqlSubscriptionClient ) Stop () error {
121+ func (c * GraphqlSubscriptionClient ) Stop () error {
122122 return c .Client .Close ()
123123}
124124
125- func (c GraphqlSubscriptionClient ) GetState () bool {
125+ func (c * GraphqlSubscriptionClient ) GetState () bool {
126126 return c .connected
127127}
0 commit comments