1
0
mirror of https://github.com/axllent/mailpit.git synced 2025-08-15 20:13:16 +02:00

API: Add API endpoint to return message headers

See #15
This commit is contained in:
Ralph Slooten
2022-10-13 02:47:51 +13:00
parent 5d32d5190d
commit b0894a8064
7 changed files with 101 additions and 59 deletions

View File

@@ -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)