|
|
@ -102,6 +102,14 @@ func (b *Api) handleMessages(c echo.Context) error {
|
|
|
|
func (b *Api) handleStream(c echo.Context) error {
|
|
|
|
func (b *Api) handleStream(c echo.Context) error {
|
|
|
|
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSON)
|
|
|
|
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSON)
|
|
|
|
c.Response().WriteHeader(http.StatusOK)
|
|
|
|
c.Response().WriteHeader(http.StatusOK)
|
|
|
|
|
|
|
|
greet := config.Message{
|
|
|
|
|
|
|
|
Event:config.EVENT_API_CONNECTED,
|
|
|
|
|
|
|
|
Timestamp:time.Now(),
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := json.NewEncoder(c.Response()).Encode(greet); err != nil {
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
c.Response().Flush()
|
|
|
|
closeNotifier := c.Response().CloseNotify()
|
|
|
|
closeNotifier := c.Response().CloseNotify()
|
|
|
|
for {
|
|
|
|
for {
|
|
|
|
select {
|
|
|
|
select {
|
|
|
|