Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/WebSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,15 @@ namespace WebSocket
m_socket.loop();
}

void broadcastMessage(String msg)
{
WebSocket::m_socket.broadcastTXT(msg.c_str());
}

void broadcastStatus()
{
String msg = "{\"status\": " + String((int)FastLEDHub.getStatus()) + ", \"currentAnimation\": \"" + FastLEDHub.getCurrentAnimationName() + "\"}";
WebSocket::m_socket.broadcastTXT(msg.c_str());
broadcastMessage(msg);
}

} // namespace WebSocket
3 changes: 3 additions & 0 deletions src/WebSocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ namespace WebSocket
/// Handle websocket
void handle();

/// Broadcast a message to all active websocket connections
void broadcastMessage(String msg);

/// Broadcast the current animation status to all active websocket connections
void broadcastStatus();

Expand Down