Fixed reference for Blueprint object
This commit is contained in:
parent
cdb6907770
commit
4af6575516
@ -7,6 +7,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var Bp *Blueprint
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
// Green, Red Bold, Red, Blue, Blue Bold, Yellow, Yellow Bold, Magenta, Magenta Bold colors
|
// Green, Red Bold, Red, Blue, Blue Bold, Yellow, Yellow Bold, Magenta, Magenta Bold colors
|
||||||
@ -58,5 +60,3 @@ func init() {
|
|||||||
log.SetFlags(0)
|
log.SetFlags(0)
|
||||||
log.SetOutput(new(logWriter))
|
log.SetOutput(new(logWriter))
|
||||||
}
|
}
|
||||||
|
|
||||||
var Bp Blueprint
|
|
||||||
|
@ -47,7 +47,9 @@ func init() {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
App.Increases()
|
App.Increases()
|
||||||
c.Bp = App.Blueprint
|
c.Bp = &App.Blueprint
|
||||||
|
s.Bp = &App.Blueprint
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"github.com/labstack/echo"
|
"github.com/labstack/echo"
|
||||||
"github.com/labstack/echo/engine/standard"
|
"github.com/labstack/echo/engine/standard"
|
||||||
"github.com/labstack/echo/middleware"
|
"github.com/labstack/echo/middleware"
|
||||||
|
c "github.com/tockins/realize/cli"
|
||||||
"golang.org/x/net/websocket"
|
"golang.org/x/net/websocket"
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var Bp *c.Blueprint
|
||||||
|
|
||||||
// Server struct contains server informations
|
// Server struct contains server informations
|
||||||
type Server struct {
|
type Server struct {
|
||||||
}
|
}
|
||||||
@ -31,12 +34,24 @@ func (s *Server) Start() {
|
|||||||
e.GET("/", func(c echo.Context) error {
|
e.GET("/", func(c echo.Context) error {
|
||||||
return render(c, "server/assets/index.html")
|
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"))
|
go e.Run(standard.New(":5000"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The WebSocket for projects list
|
||||||
func projects() websocket.Handler {
|
func projects() websocket.Handler {
|
||||||
return websocket.Handler(func(ws *websocket.Conn) {
|
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