mirror of
https://github.com/axllent/mailpit.git
synced 2025-08-15 20:13:16 +02:00
@@ -7,7 +7,6 @@ package websockets
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/axllent/mailpit/data"
|
||||
"github.com/axllent/mailpit/logger"
|
||||
)
|
||||
|
||||
@@ -27,6 +26,12 @@ type Hub struct {
|
||||
unregister chan *Client
|
||||
}
|
||||
|
||||
// WebsocketNotification struct for responses
|
||||
type WebsocketNotification struct {
|
||||
Type string
|
||||
Data interface{}
|
||||
}
|
||||
|
||||
// NewHub returns a new hub configuration
|
||||
func NewHub() *Hub {
|
||||
return &Hub{
|
||||
@@ -68,7 +73,7 @@ func Broadcast(t string, msg interface{}) {
|
||||
return
|
||||
}
|
||||
|
||||
w := data.WebsocketNotification{}
|
||||
w := WebsocketNotification{}
|
||||
w.Type = t
|
||||
w.Data = msg
|
||||
b, err := json.Marshal(w)
|
||||
|
Reference in New Issue
Block a user