multi channel chat demo

This commit is contained in:
Ola Holmström
2015-05-14 19:29:20 +02:00
parent dce8735ee4
commit 4adcb388e6
7 changed files with 154 additions and 28 deletions
+10 -7
View File
@@ -2,21 +2,24 @@ package melody
import (
"github.com/gorilla/websocket"
"net/http"
"time"
)
// A melody session.
type Session struct {
conn *websocket.Conn
output chan *envelope
config *Config
Request *http.Request
conn *websocket.Conn
output chan *envelope
config *Config
}
func newSession(config *Config, conn *websocket.Conn) *Session {
func newSession(config *Config, conn *websocket.Conn, req *http.Request) *Session {
return &Session{
conn: conn,
output: make(chan *envelope, config.MessageBufferSize),
config: config,
Request: req,
conn: conn,
output: make(chan *envelope, config.MessageBufferSize),
config: config,
}
}