websocket fixed
This commit is contained in:
parent
51238900af
commit
e69e687407
|
@ -103,16 +103,19 @@ func (s *Server) projects(c echo.Context) error {
|
||||||
defer ws.Close()
|
defer ws.Close()
|
||||||
msg, _ := json.Marshal(s.Blueprint.Projects)
|
msg, _ := json.Marshal(s.Blueprint.Projects)
|
||||||
err := websocket.Message.Send(ws, string(msg))
|
err := websocket.Message.Send(ws, string(msg))
|
||||||
for {
|
go func() {
|
||||||
select {
|
for {
|
||||||
case <-s.Sync:
|
select {
|
||||||
msg, _ := json.Marshal(s.Blueprint.Projects)
|
case <-s.Sync:
|
||||||
err = websocket.Message.Send(ws, string(msg))
|
msg, _ := json.Marshal(s.Blueprint.Projects)
|
||||||
if err != nil {
|
err = websocket.Message.Send(ws, string(msg))
|
||||||
break
|
if err != nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}()
|
||||||
|
for {
|
||||||
// Read
|
// Read
|
||||||
text := ""
|
text := ""
|
||||||
err := websocket.Message.Receive(ws, &text)
|
err := websocket.Message.Receive(ws, &text)
|
||||||
|
|
|
@ -22,7 +22,7 @@ func init() {
|
||||||
|
|
||||||
// Open a url in the default browser
|
// Open a url in the default browser
|
||||||
func Open(url string) (io.Writer, error) {
|
func Open(url string) (io.Writer, error) {
|
||||||
open, err := cmd[runtime.GOOS];
|
open, err := cmd[runtime.GOOS]
|
||||||
if !err {
|
if !err {
|
||||||
return nil, errors.New("This operating system is not supported.")
|
return nil, errors.New("This operating system is not supported.")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue