From 4bd4c0417cc915e0bd73d06db2a53d34c4207397 Mon Sep 17 00:00:00 2001 From: chteufleur Date: Fri, 16 Dec 2016 22:05:06 +0100 Subject: [PATCH] Add viewlog controller --- controllers/viewLog.go | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/controllers/viewLog.go b/controllers/viewLog.go index f33a901..7c042b0 100644 --- a/controllers/viewLog.go +++ b/controllers/viewLog.go @@ -2,16 +2,14 @@ package controllers import ( "github.com/astaxie/beego" - "github.com/gorilla/websocket" + "github.com/gorilla/websocket" - "git.kingpenguin.tk/chteufleur/datahouse.git/models/variables" - "git.kingpenguin.tk/chteufleur/datahouse.git/watchlog" + "git.kingpenguin.tk/chteufleur/datahouse.git/models/variables" + "git.kingpenguin.tk/chteufleur/datahouse.git/watchlog" "net/http" ) - - type WebSocketController struct { beego.Controller } @@ -28,16 +26,12 @@ func (c *WebSocketController) Prepare() { c.Data["version"] = variables.Version } - // Get method handles GET requests for WebSocketController. func (c *WebSocketController) Get() { - c.Data["hostWS"] = "ws://"+c.Ctx.Request.Host+variables.WebSocketLogRoute + c.Data["hostWS"] = "ws://" + c.Ctx.Request.Host + variables.WebSocketLogRoute c.TplName = "watchlog.tpl" } - - - // Join method handles WebSocket requests for WebSocketController. func (this *WebSocketController) Join() { // Upgrade from http request to WebSocket. @@ -50,8 +44,7 @@ func (this *WebSocketController) Join() { return } - watchlog.ListWebSocket.PushFront(ws) - + watchlog.ListWebSocket.PushFront(ws) // Message receive loop. for {