added websocket-driven notification-overlay
This commit is contained in:
@@ -830,4 +830,38 @@ int findIndexByString(const char *searchString, const char *const *array, int ar
|
||||
}
|
||||
// String nicht gefunden, gib -1 zurück
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pushes a notification to all WebSocket clients.
|
||||
*
|
||||
* This function sends a live debug message to all connected WebSocket clients.
|
||||
*
|
||||
* @param Message The debug message to be sent.
|
||||
* @param type The type of notification (info, success, warning, error).
|
||||
* - Use NotificationType_t::info for informational messages.
|
||||
* - Use NotificationType_t::success for successful operation messages.
|
||||
* - Use NotificationType_t::warning for warning messages.
|
||||
* - Use NotificationType_t::error for error messages.
|
||||
*/
|
||||
void Websocket_PushNotification(String Message, NotificationType_t type)
|
||||
{
|
||||
String typeString = "";
|
||||
switch (type)
|
||||
{
|
||||
case info:
|
||||
typeString = "info";
|
||||
break;
|
||||
case success:
|
||||
typeString = "success";
|
||||
break;
|
||||
case warning:
|
||||
typeString = "warning";
|
||||
break;
|
||||
case error:
|
||||
typeString = "danger";
|
||||
break;
|
||||
}
|
||||
webSocket.textAll("NOTIFY:" + typeString + ";" + Message);
|
||||
Debug_pushMessage("Sending Notification to WebUI: %s\n", typeString);
|
||||
}
|
Reference in New Issue
Block a user