diff options
Diffstat (limited to 'web/websocket')
| -rw-r--r-- | web/websocket/hub.go | 1 | ||||
| -rw-r--r-- | web/websocket/notifier.go | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/web/websocket/hub.go b/web/websocket/hub.go index 187ebb6f..7ee93405 100644 --- a/web/websocket/hub.go +++ b/web/websocket/hub.go @@ -20,6 +20,7 @@ const ( MessageTypeInbounds MessageType = "inbounds" // Inbounds list update MessageTypeNotification MessageType = "notification" // System notification MessageTypeXrayState MessageType = "xray_state" // Xray state change + MessageTypeOutbounds MessageType = "outbounds" // Outbounds list update ) // Message represents a WebSocket message diff --git a/web/websocket/notifier.go b/web/websocket/notifier.go index cedf56f2..416adaff 100644 --- a/web/websocket/notifier.go +++ b/web/websocket/notifier.go @@ -48,6 +48,14 @@ func BroadcastInbounds(inbounds interface{}) { } } +// BroadcastOutbounds broadcasts outbounds list update to all connected clients +func BroadcastOutbounds(outbounds interface{}) { + hub := GetHub() + if hub != nil { + hub.Broadcast(MessageTypeOutbounds, outbounds) + } +} + // BroadcastNotification broadcasts a system notification to all connected clients func BroadcastNotification(title, message, level string) { hub := GetHub() |
