github.com/optim-corp/cios-golang-sdk@v0.5.1/sdk/service/pubsub/init.go (about) 1 package srvpubsub 2 3 import ( 4 "context" 5 6 "github.com/optim-corp/cios-golang-sdk/cios" 7 ) 8 9 type CiosPubSub struct { 10 ApiClient *cios.APIClient 11 Url string 12 Host string 13 withHost func(context.Context) context.Context 14 refresh func() error 15 debug bool 16 token *string 17 wsReadTimeout int64 18 wsWriteTimeout int64 19 } 20 21 func (self *CiosPubSub) SetRefresh(refresh func() error) { 22 self.refresh = refresh 23 } 24 25 func (self *CiosPubSub) SetWsReadTimeout(wsReadTimeout int64) { 26 self.wsReadTimeout = wsReadTimeout 27 } 28 29 func (self *CiosPubSub) SetWsWriteTimeout(wsWriteTimeout int64) { 30 self.wsWriteTimeout = wsWriteTimeout 31 } 32 33 func NewCiosPubSub(apiClient *cios.APIClient, url string, withHost func(context.Context) context.Context) *CiosPubSub { 34 return &CiosPubSub{ApiClient: apiClient, Url: url, withHost: withHost} 35 } 36 37 func (self *CiosPubSub) SetDebug(isDebug bool) { 38 self.debug = isDebug 39 } 40 41 func (self *CiosPubSub) SetToken(token string) { 42 if token == "" { 43 self.token = nil 44 } else { 45 self.token = &token 46 } 47 }