Undici exposes a WHATWG spec-compliant implementation of EventSource for Server-Sent Events.
Undici exports a EventSource class. You can instantiate the EventSource as follows:
import { EventSource } from 'undici'
const evenSource = new EventSource('http://localhost:3000')
evenSource.onmessage = (event) => {
console.log(event.data)
}
More information about the EventSource API can be found on MDN.