-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmessage.go
More file actions
36 lines (31 loc) · 928 Bytes
/
message.go
File metadata and controls
36 lines (31 loc) · 928 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
package ws
const (
PING = "PING"
PONG = "PONG"
JSONRPC = "2.0"
)
type ResponseMessage struct {
JSONRPC string `json:"jsonrpc"`
ID uint64 `json:"id,omitempty"`
Method string `json:"method,omitempty"`
Result any `json:"result,omitempty"`
Params any `json:"params,omitempty"`
UsIn uint64 `json:"usIn,omitempty"`
UsOut uint64 `json:"usOut,omitempty"`
UsDiff uint64 `json:"usDiff,omitempty"`
Error *ErrorMessage `json:"error,omitempty"`
}
type ErrorMessage struct {
Message string `json:"message"`
Data *ReasonMessage `json:"data"`
Code int64 `json:"code"`
}
type ReasonMessage struct {
Reason string `json:"reason"`
}
type RequestMessage struct {
JSONRPC string `json:"jsonrpc"`
Method string `json:"method"`
ID *uint64 `json:"id,omitempty"`
Params interface{} `json:"params"`
}