Skip to content

Fix/websocket event cleanup#646

Merged
scottdraves merged 1 commit into
e-dream-ai:masterfrom
amillionbouncyballs:fix/websocket-event-cleanup
May 22, 2026
Merged

Fix/websocket event cleanup#646
scottdraves merged 1 commit into
e-dream-ai:masterfrom
amillionbouncyballs:fix/websocket-event-cleanup

Conversation

@amillionbouncyballs

Copy link
Copy Markdown
Collaborator

fix: correct g_Log->Error format-string output and silence 'playing' noise.

CLog::Error was calling PlatformUtils::NotifyError(_pFmt) before the grabvarargs macro had expanded the format string, so NotifyError received the raw format string (e.g. "Unknown event type received: %s") and printed it literally via fprintf(stderr, "[ERROR] %.*s\n", ...). Fixed by moving the NotifyError call to after grabvarargs so it receives the already-formatted pTempStr.

WebSocket event handler (EDreamClient.cpp):

  • Add a WsEvent namespace with constexpr std::string_view constants for all 31 known event names, replacing the inline string literals in the handler. This avoids per-comparison std::string construction and makes the set of known events easy to audit at a glance.

  • Handle the "playing" event explicitly (server acknowledgement of our state_sync) — previously fell through to the error branch, flooding the log with spurious errors on every dream transition.

  • Remove stray debug printf calls (bare "Received websocket message: %s" and "Frame number: ...") that were writing to stdout with no newline, interleaving with the structured log output.

…noise

CLog::Error was calling PlatformUtils::NotifyError(_pFmt) before the
grabvarargs macro had expanded the format string, so NotifyError received
the raw format string (e.g. "Unknown event type received: %s") and printed
it literally via fprintf(stderr, "[ERROR] %.*s\n", ...). Fix by moving the
NotifyError call to after grabvarargs so it receives the already-formatted
pTempStr.

WebSocket event handler (EDreamClient.cpp):
- Add a WsEvent namespace with constexpr std::string_view constants for all
  31 known event names, replacing the inline string literals in the handler.
  This avoids per-comparison std::string construction and makes the set of
  known events easy to audit at a glance.
- Handle the "playing" event explicitly (server acknowledgement of our
  state_sync) — previously fell through to the error branch, flooding the
  log with spurious errors on every dream transition.
- Remove stray debug printf calls (bare "Received websocket message: %s"
  and "Frame number: ...") that were writing to stdout with no newline,
  interleaving with the structured log output.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@amillionbouncyballs amillionbouncyballs force-pushed the fix/websocket-event-cleanup branch from dc98ec1 to ff86c78 Compare May 22, 2026 08:06
@amillionbouncyballs

Copy link
Copy Markdown
Collaborator Author

Oops, initially contained #645 - now rebased on master and force pushed. I don't like force-pushing, but it's only to my fork so who cares - it's all the same thing when we squash & merge.

@scottdraves scottdraves merged commit 1dfe1c1 into e-dream-ai:master May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants