Skip to content

Commit

Permalink
Pass struct along with OnEvent event.
Browse files Browse the repository at this point in the history
  • Loading branch information
bwmarrin committed Apr 11, 2016
1 parent 92c27c7 commit 836e78d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions wsapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 836e78d

Please sign in to comment.