Skip to content

Commit

Permalink
Merge pull request olahol#2 from huljas/generic_params
Browse files Browse the repository at this point in the history
Changed session params to be generic type
  • Loading branch information
huljas authored Nov 18, 2016
2 parents 0d8427c + aae1ca8 commit 150502c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
2 changes: 1 addition & 1 deletion melody.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (m *Melody) HandleRequest(w http.ResponseWriter, r *http.Request) {

session := &Session{
Request: r,
params: make(map[string]string),
Params: make(map[string]interface{}),
conn: conn,
output: make(chan *envelope, m.Config.MessageBufferSize),
melody: m,
Expand Down
12 changes: 1 addition & 11 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
// A melody session.
type Session struct {
Request *http.Request
params map[string]string
Params map[string]interface{}
conn *websocket.Conn
output chan *envelope
melody *Melody
Expand Down Expand Up @@ -118,13 +118,3 @@ func (s *Session) WriteBinary(msg []byte) {
func (s *Session) Close() {
s.writeMessage(&envelope{t: websocket.CloseMessage, msg: []byte{}})
}

// Set session param
func (s *Session) SetParam(key string, value string) {
s.params[key] = value
}

// Get session param
func (s *Session) GetParam(key string) string {
return s.params[key]
}

0 comments on commit 150502c

Please sign in to comment.