func NewServerStreamer(responseWriter io.Writer, chunkSize int) (*ServerStreamer, error) {
	if responseWriter == nil {
		return nil, fmt.Errorf("error: responseWriter provided is nil")
	}
	flusher, ok := responseWriter.(http.Flusher)
	if !ok {
		return nil, fmt.Errorf("error: responseWriter provided does not implement http.Flusher")
	}
	if chunkSize < 0 {
		return nil, fmt.Errorf("error: chunkSize must be non-negative")
	}
	streamer := &ServerStreamer{
		chunkSize: chunkSize,
		output:    responseWriter,
		flusher:   flusher,
		marshaler: ToJSON(),
	}
	return streamer, nil
}
NewServerStreamer returns a ServerStreamer instance initialized to write to responseWriter. Users
must call the End() method to terminate the stream properly, typically by using `defer`. Note
that responseWriter must also be an http.Flusher. If chunkSize is positive, messages written to
this ServerStreamer are chunked-encoded into chunks of size chunkSize (except for the final
chunk, which could be smaller). If chunkSize is zero, each message is written into a single
chunk.
package resttools
import (
	"bytes"
	"context"
	"fmt"
	"io"
	"net/http"
	"google.golang.org/grpc"
	"google.golang.org/protobuf/encoding/protojson"
	"google.golang.org/protobuf/proto"
)
const ServerStreamingChunkSize = 30
type ServerStreamer struct {
	buffer    bytes.Buffer  
	chunkSize int
	output    io.Writer     
	flusher   http.Flusher  
	marshaler *protojson.MarshalOptions
	started   bool
	grpc.ServerStream
}