github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/app/rpc/websockets/types.go (about) 1 package websockets 2 3 import ( 4 "math/big" 5 6 "github.com/ethereum/go-ethereum/rpc" 7 8 rpcfilters "github.com/fibonacci-chain/fbc/app/rpc/namespaces/eth/filters" 9 ) 10 11 type SubscriptionResponseJSON struct { 12 Jsonrpc string `json:"jsonrpc"` 13 Result interface{} `json:"result"` 14 ID float64 `json:"id"` 15 } 16 17 type SubscriptionNotification struct { 18 Jsonrpc string `json:"jsonrpc"` 19 Method string `json:"method"` 20 Params *SubscriptionResult `json:"params"` 21 } 22 23 type SubscriptionResult struct { 24 Subscription rpc.ID `json:"subscription"` 25 Result interface{} `json:"result"` 26 } 27 28 type ErrorResponseJSON struct { 29 Jsonrpc string `json:"jsonrpc"` 30 Error *ErrorMessageJSON `json:"error"` 31 ID *big.Int `json:"id"` 32 } 33 34 type ErrorMessageJSON struct { 35 Code *big.Int `json:"code"` 36 Message string `json:"message"` 37 } 38 39 type wsSubscription struct { 40 sub *rpcfilters.Subscription 41 unsubscribed chan struct{} // closed when unsubscribing 42 conn *wsConn 43 }