forked from jshiffer/matterbridge
parent
1269be1d04
commit
d058be25ad
@ -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 {
|
||||||
|
@ -22,6 +22,7 @@ const (
|
|||||||
EVENT_REJOIN_CHANNELS = "rejoin_channels"
|
EVENT_REJOIN_CHANNELS = "rejoin_channels"
|
||||||
EVENT_USER_ACTION = "user_action"
|
EVENT_USER_ACTION = "user_action"
|
||||||
EVENT_MSG_DELETE = "msg_delete"
|
EVENT_MSG_DELETE = "msg_delete"
|
||||||
|
EVENT_API_CONNECTED = "api_connected"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Message struct {
|
type Message struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user