Project WebSocket endpoint

This commit is contained in:
conventi 2016-09-17 15:33:07 +02:00
parent 4af6575516
commit 07e0743041
1 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,8 @@
package server package server
import ( import (
"encoding/json"
"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"
@ -43,7 +45,9 @@ func (s *Server) Start() {
func projects() websocket.Handler { func projects() websocket.Handler {
return websocket.Handler(func(ws *websocket.Conn) { return websocket.Handler(func(ws *websocket.Conn) {
for { for {
err := websocket.Message.Send(ws, "Hello") message, _ := json.Marshal(Bp)
err := websocket.Message.Send(ws, string(message))
fmt.Println(Bp)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }