forked from YonatanDEV1/nitro-sniper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsession.go
More file actions
41 lines (36 loc) · 785 Bytes
/
session.go
File metadata and controls
41 lines (36 loc) · 785 Bytes
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
package main
import (
"github.com/gorilla/websocket"
"time"
"sync"
)
func socketConnection(token string) (session *Session) {
s := &Session{
dialer: websocket.DefaultDialer,
sequence: new(int64),
token: token,
gateway: "wss://gateway.discord.gg",
}
if s.RateLimiter == nil {
s.RateLimiter = NewRateLimiter(s.RateRateLimiterConfigOpts...)
}
return s
}
type Session struct {
RateRateLimiterConfigOpts []RateLimiterConfigOpt
socketConnection *websocket.Conn
heartbeatInterval time.Duration
listening chan interface{}
dialer *websocket.Dialer
heartbeatSent time.Time
RateLimiter RateLimiter
socketMutex sync.Mutex
heartbeatAck time.Time
isConnected bool
sessionId string
sequence *int64
gateway string
account string
token string
sync.RWMutex
}