forked from dfuse-io/eosws-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathregistry.go
31 lines (25 loc) · 780 Bytes
/
registry.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
package eosws
import "reflect"
var IncomingMessageMap = map[string]reflect.Type{}
var IncomingStructMap = map[reflect.Type]string{}
var OutgoingMessageMap = map[string]reflect.Type{}
var OutgoingStructMap = map[reflect.Type]string{}
func RegisterIncomingMessage(typeName string, obj interface{}) {
refType := reflect.TypeOf(obj)
IncomingMessageMap[typeName] = refType
IncomingStructMap[refType] = typeName
}
func RegisterOutgoingMessage(typeName string, obj interface{}) {
refType := reflect.TypeOf(obj)
OutgoingMessageMap[typeName] = refType
OutgoingStructMap[refType] = typeName
}
type OutgoingMessager interface {
SetType(v string)
SetReqID(v string)
}
// type IncomingMessager interface {
// GetType() string
// GetReqID() string
// GetCommon() CommonIn
// }