diff --git a/cli/main.go b/cli/main.go index 196c19f..e1cf7f9 100644 --- a/cli/main.go +++ b/cli/main.go @@ -7,6 +7,8 @@ import ( "time" ) +var Bp *Blueprint + var wg sync.WaitGroup // Green, Red Bold, Red, Blue, Blue Bold, Yellow, Yellow Bold, Magenta, Magenta Bold colors @@ -58,5 +60,3 @@ func init() { log.SetFlags(0) log.SetOutput(new(logWriter)) } - -var Bp Blueprint diff --git a/realize.go b/realize.go index 0da49d8..8c23614 100644 --- a/realize.go +++ b/realize.go @@ -47,7 +47,9 @@ func init() { }, } App.Increases() - c.Bp = App.Blueprint + c.Bp = &App.Blueprint + s.Bp = &App.Blueprint + } func main() { diff --git a/server/main.go b/server/main.go index 3b5281c..c5d2d4c 100644 --- a/server/main.go +++ b/server/main.go @@ -1,14 +1,17 @@ package server import ( - "fmt" "github.com/labstack/echo" "github.com/labstack/echo/engine/standard" "github.com/labstack/echo/middleware" + c "github.com/tockins/realize/cli" "golang.org/x/net/websocket" + "log" "net/http" ) +var Bp *c.Blueprint + // Server struct contains server informations type Server struct { } @@ -31,12 +34,24 @@ func (s *Server) Start() { e.GET("/", func(c echo.Context) error { return render(c, "server/assets/index.html") }) - e.GET("/ws", standard.WrapHandler(projects())) + + e.GET("/projects", standard.WrapHandler(projects())) go e.Run(standard.New(":5000")) } +// The WebSocket for projects list func projects() websocket.Handler { return websocket.Handler(func(ws *websocket.Conn) { - fmt.Println(12) + for { + err := websocket.Message.Send(ws, "Hello") + if err != nil { + log.Fatal(err) + } + msg := "" + err = websocket.Message.Receive(ws, &msg) + if err != nil { + log.Fatal(err) + } + } }) }