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