summaryrefslogtreecommitdiff
path: root/pages.go
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2014-03-27 12:28:05 +0100
committerKevin Chabowski <kevin@kch42.de>2014-03-27 23:51:07 +0100
commitdfd11c94c1ad5261caa43128a39fcce550edf61d (patch)
treeb80458e610077b17da9815d14f71f590d4de56af /pages.go
parentc35e43e9cf0f915236016a3f73a6ee6bc9962e0b (diff)
downloadsimplechat-dfd11c94c1ad5261caa43128a39fcce550edf61d.tar.gz
simplechat-dfd11c94c1ad5261caa43128a39fcce550edf61d.tar.bz2
simplechat-dfd11c94c1ad5261caa43128a39fcce550edf61d.zip
Chat now works on the client side
Diffstat (limited to 'pages.go')
-rw-r--r--pages.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/pages.go b/pages.go
index 40c2c21..886f1d6 100644
--- a/pages.go
+++ b/pages.go
@@ -1,6 +1,7 @@
package main
import (
+ "github.com/gorilla/mux"
"html/template"
"net/http"
"path"
@@ -11,7 +12,7 @@ var (
)
type ChatpageData struct {
- Websock string
+ Websock, Roomname string
}
func PrepTemplates() {
@@ -24,5 +25,6 @@ func Home(rw http.ResponseWriter, req *http.Request) {
}
func Chatpage(rw http.ResponseWriter, req *http.Request) {
- TplChat.Execute(rw, ChatpageData{"ws://" + req.Host + req.URL.Path + "socket"})
+ vars := mux.Vars(req)
+ TplChat.Execute(rw, ChatpageData{"ws://" + req.Host + req.URL.Path + "socket", vars["chatroom"]})
}