Fixed reference for Blueprint object
This commit is contained in:
parent
cdb6907770
commit
4af6575516
@ -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
|
||||
|
@ -47,7 +47,9 @@ func init() {
|
||||
},
|
||||
}
|
||||
App.Increases()
|
||||
c.Bp = App.Blueprint
|
||||
c.Bp = &App.Blueprint
|
||||
s.Bp = &App.Blueprint
|
||||
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user