The htmx:before:sse:message event fires when an SSE message arrives, before htmx processes it.
When It Fires
When the SSE stream receives a message from the server, before content swapping.
Event Detail
ctx- Request contextmessage- Message object withdata,event, andidproperties
Example
htmx.on('htmx:before:sse:message', (evt) => { console.log('SSE message:', evt.detail.message.data); // Filter or modify message before processing });
Cancel this event to skip processing this particular message.