From dfd11c94c1ad5261caa43128a39fcce550edf61d Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Thu, 27 Mar 2014 12:28:05 +0100 Subject: Chat now works on the client side --- pages.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pages.go') 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"]}) } -- cgit v1.2.3-70-g09d2