Browse Source

Pass struct along with OnEvent event.

Bruce Marriner 8 years ago
parent
commit
836e78d3d9
2 changed files with 3 additions and 0 deletions
  1. 1 0
      structs.go
  2. 2 0
      wsapi.go

+ 1 - 0
structs.go

@@ -265,6 +265,7 @@ type Event struct {
 	Operation int             `json:"op"`
 	Direction int             `json:"dir"`
 	RawData   json.RawMessage `json:"d"`
+	Struct    interface{}     `json:"-"`
 }
 
 // A Ready stores all data for the websocket READY event.

+ 2 - 0
wsapi.go

@@ -301,6 +301,8 @@ func (s *Session) event(messageType int, message []byte) {
 	if i != nil {
 		s.handle(i)
 	}
+
+	e.Struct = i
 	s.handle(e)
 
 	return