func NewEncoder(w io.Writer) *Encoder {
	if w, ok := w.(FlushWriter); ok {
		return &Encoder{w}
	}
	return &Encoder{noopFlusher{w}}
}
NewEncoder returns a new encoder that writes to w.
package eventsource
import (
	"bytes"
	"fmt"
	"io"
	"unicode/utf8"
)
type FlushWriter interface {
	io.Writer
	Flush()
}
type noopFlusher struct {
	io.Writer
}
func (noopFlusher) Flush() {}
type Encoder struct {
	w FlushWriter
}