forked from thrasher-corp/gocryptotrader
-
Notifications
You must be signed in to change notification settings - Fork 1
/
websocket_types.go
49 lines (42 loc) · 1.3 KB
/
websocket_types.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
package engine
import "github.com/gorilla/websocket"
// WebsocketClient stores information related to the websocket client
type WebsocketClient struct {
Hub *WebsocketHub
Conn *websocket.Conn
Authenticated bool
authFailures int
Send chan []byte
}
// WebsocketHub stores the data for managing websocket clients
type WebsocketHub struct {
Clients map[*WebsocketClient]bool
Broadcast chan []byte
Register chan *WebsocketClient
Unregister chan *WebsocketClient
}
// WebsocketEvent is the struct used for websocket events
type WebsocketEvent struct {
Exchange string `json:"exchange,omitempty"`
AssetType string `json:"assetType,omitempty"`
Event string
Data interface{}
}
// WebsocketEventResponse is the struct used for websocket event responses
type WebsocketEventResponse struct {
Event string `json:"event"`
Data interface{} `json:"data"`
Error string `json:"error"`
}
// WebsocketOrderbookTickerRequest is a struct used for ticker and orderbook
// requests
type WebsocketOrderbookTickerRequest struct {
Exchange string `json:"exchangeName"`
Currency string `json:"currency"`
AssetType string `json:"assetType"`
}
// WebsocketAuth is a struct used for
type WebsocketAuth struct {
Username string `json:"username"`
Password string `json:"password"`
}