forked from aopoltorzhicky/go_kraken
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparameters.go
74 lines (66 loc) · 2.17 KB
/
parameters.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package websocket
import (
"time"
)
// Parameters defines adapter behavior.
type Parameters struct {
AutoReconnect bool
ReconnectInterval time.Duration
ReconnectAttempts int
reconnectTry int
ShutdownTimeout time.Duration
ContextTimeout time.Duration
ResubscribeOnReconnect bool
HeartbeatCheckPeriod time.Duration
HeartbeatTimeout time.Duration
LogTransport bool
URL string
}
// NewDefaultParameters - create default Parameters object for prod
func NewDefaultParameters() *Parameters {
return &Parameters{
AutoReconnect: true,
ReconnectInterval: time.Second,
reconnectTry: 0,
ReconnectAttempts: 5,
URL: ProdBaseURL,
ShutdownTimeout: time.Second * 5,
ResubscribeOnReconnect: true,
HeartbeatCheckPeriod: time.Millisecond * 100,
HeartbeatTimeout: time.Second * 3, // HB = 3s
LogTransport: false, // log transport send/recv,
ContextTimeout: time.Second * 5,
}
}
// NewDefaultSandboxParameters - create default Parameters object for sandbox
func NewDefaultSandboxParameters() *Parameters {
return &Parameters{
AutoReconnect: true,
ReconnectInterval: time.Second,
reconnectTry: 0,
ReconnectAttempts: 5,
URL: SandboxBaseURL,
ShutdownTimeout: time.Second * 5,
ResubscribeOnReconnect: true,
HeartbeatTimeout: time.Second * 3, // HB = 3s
HeartbeatCheckPeriod: time.Millisecond * 100,
LogTransport: false, // log transport send/recv
ContextTimeout: time.Second * 5,
}
}
// NewDefaultAuthParameters - create default Parameters object for auth socket
func NewDefaultAuthParameters() *Parameters {
return &Parameters{
AutoReconnect: true,
ReconnectInterval: time.Second,
reconnectTry: 0,
ReconnectAttempts: 5,
URL: AuthBaseURL,
ShutdownTimeout: time.Second * 5,
ResubscribeOnReconnect: true,
HeartbeatTimeout: time.Second * 3, // HB = 3s
HeartbeatCheckPeriod: time.Millisecond * 100,
LogTransport: false, // log transport send/recv,
ContextTimeout: time.Second * 5,
}
}