Pass struct along with OnEvent event.
This commit is contained in:
parent
92c27c7712
commit
836e78d3d9
2 changed files with 3 additions and 0 deletions
|
@ -265,6 +265,7 @@ type Event struct {
|
||||||
Operation int `json:"op"`
|
Operation int `json:"op"`
|
||||||
Direction int `json:"dir"`
|
Direction int `json:"dir"`
|
||||||
RawData json.RawMessage `json:"d"`
|
RawData json.RawMessage `json:"d"`
|
||||||
|
Struct interface{} `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// A Ready stores all data for the websocket READY event.
|
// A Ready stores all data for the websocket READY event.
|
||||||
|
|
2
wsapi.go
2
wsapi.go
|
@ -301,6 +301,8 @@ func (s *Session) event(messageType int, message []byte) {
|
||||||
if i != nil {
|
if i != nil {
|
||||||
s.handle(i)
|
s.handle(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
e.Struct = i
|
||||||
s.handle(e)
|
s.handle(e)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue