From 836e78d3d99723730facbb5be2b4611082d5ca46 Mon Sep 17 00:00:00 2001 From: Bruce Marriner Date: Mon, 11 Apr 2016 16:56:43 -0500 Subject: [PATCH] Pass struct along with OnEvent event. --- structs.go | 1 + wsapi.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/structs.go b/structs.go index a7a4ef2..a51c0ac 100644 --- a/structs.go +++ b/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. diff --git a/wsapi.go b/wsapi.go index d5a6169..765b705 100644 --- a/wsapi.go +++ b/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