func (s *OpenPublisherOutWebsocketStream) Read() (*cherami.InputHostCommand, error) {
	msg, err := s.stream.Read()
	if err != nil {
		return nil, err
	}
	return msg.(*cherami.InputHostCommand), err
}
Read returns the next argument, if any is available.
package common
import (
	"fmt"
	"net/http"
	"reflect"
	"github.com/uber/cherami-client-go/common"
	"github.com/uber/cherami-client-go/common/websocket"
	"github.com/uber/cherami-client-go/stream"
	serverStream "github.com/uber/cherami-server/stream"
	"github.com/uber/cherami-thrift/.generated/go/cherami"
	"github.com/uber/cherami-thrift/.generated/go/store"
)
type (
	WSConnector interface {
		OpenPublisherStream(hostPort string, requestHeader http.Header) (stream.BInOpenPublisherStreamOutCall, error)
		AcceptPublisherStream(w http.ResponseWriter, r *http.Request) (serverStream.BInOpenPublisherStreamInCall, error)
		OpenConsumerStream(hostPort string, requestHeader http.Header) (stream.BOutOpenConsumerStreamOutCall, error)
		AcceptConsumerStream(w http.ResponseWriter, r *http.Request) (serverStream.BOutOpenConsumerStreamInCall, error)
		OpenAppendStream(hostPort string, requestHeader http.Header) (serverStream.BStoreOpenAppendStreamOutCall, error)
		AcceptAppendStream(w http.ResponseWriter, r *http.Request) (serverStream.BStoreOpenAppendStreamInCall, error)
		OpenReadStream(hostPort string, requestHeader http.Header) (serverStream.BStoreOpenReadStreamOutCall, error)
		AcceptReadStream(w http.ResponseWriter, r *http.Request) (serverStream.BStoreOpenReadStreamInCall, error)
		OpenReplicationReadStream(hostPort string, requestHeader http.Header) (serverStream.BStoreOpenReadStreamOutCall, error)
		AcceptReplicationReadStream(w http.ResponseWriter, r *http.Request) (serverStream.BStoreOpenReadStreamInCall, error)
		OpenReplicationRemoteReadStream(hostPort string, requestHeader http.Header) (serverStream.BStoreOpenReadStreamOutCall, error)
		AcceptReplicationRemoteReadStream(w http.ResponseWriter, r *http.Request) (serverStream.BStoreOpenReadStreamInCall, error)
	}
	wsConnectorImpl struct {
		wsHub websocket.Hub
		openPublisherOutStreamReadType reflect.Type
		openPublisherInStreamReadType  reflect.Type
		openConsumerOutStreamReadType  reflect.Type
		openConsumerInStreamReadType   reflect.Type
		openAppendOutStreamReadType    reflect.Type
		openAppendInStreamReadType     reflect.Type
		openReadOutStreamReadType      reflect.Type
		openReadInStreamReadType       reflect.Type
	}
	OpenPublisherOutWebsocketStream struct {
		stream websocket.StreamClient
	}
	OpenPublisherInWebsocketStream struct {
		stream websocket.StreamServer
	}
	OpenConsumerOutWebsocketStream struct {
		stream websocket.StreamClient
	}
	OpenConsumerInWebsocketStream struct {
		stream websocket.StreamServer
	}
	OpenAppendOutWebsocketStream struct {
		stream websocket.StreamClient
	}
	OpenAppendInWebsocketStream struct {
		stream websocket.StreamServer
	}
	OpenReadOutWebsocketStream struct {
		stream websocket.StreamClient
	}
	OpenReadInWebsocketStream struct {
		stream websocket.StreamServer
	}
)
var _ WSConnector = (*wsConnectorImpl)(nil)
var _ stream.BInOpenPublisherStreamOutCall = (*OpenPublisherOutWebsocketStream)(nil)
var _ serverStream.BInOpenPublisherStreamInCall = (*OpenPublisherInWebsocketStream)(nil)
var _ stream.BOutOpenConsumerStreamOutCall = (*OpenConsumerOutWebsocketStream)(nil)
var _ serverStream.BOutOpenConsumerStreamInCall = (*OpenConsumerInWebsocketStream)(nil)
var _ serverStream.BStoreOpenAppendStreamOutCall = (*OpenAppendOutWebsocketStream)(nil)
var _ serverStream.BStoreOpenAppendStreamInCall = (*OpenAppendInWebsocketStream)(nil)
var _ serverStream.BStoreOpenReadStreamOutCall = (*OpenReadOutWebsocketStream)(nil)
var _ serverStream.BStoreOpenReadStreamInCall = (*OpenReadInWebsocketStream)(nil)
func NewWSConnector() WSConnector {
	return &wsConnectorImpl{
		wsHub: websocket.NewWebsocketHub(),
		openPublisherOutStreamReadType: reflect.TypeOf((*cherami.InputHostCommand)(nil)).Elem(),
		openPublisherInStreamReadType:  reflect.TypeOf((*cherami.PutMessage)(nil)).Elem(),
		openConsumerOutStreamReadType:  reflect.TypeOf((*cherami.OutputHostCommand)(nil)).Elem(),
		openConsumerInStreamReadType:   reflect.TypeOf((*cherami.ControlFlow)(nil)).Elem(),
		openAppendOutStreamReadType:    reflect.TypeOf((*store.AppendMessageAck)(nil)).Elem(),
		openAppendInStreamReadType:     reflect.TypeOf((*store.AppendMessage)(nil)).Elem(),
		openReadOutStreamReadType:      reflect.TypeOf((*store.ReadMessageContent)(nil)).Elem(),
		openReadInStreamReadType:       reflect.TypeOf((*cherami.ControlFlow)(nil)).Elem(),
	}
}
func (c *wsConnectorImpl) OpenPublisherStream(hostPort string, requestHeader http.Header) (stream.BInOpenPublisherStreamOutCall, error) {
	url := fmt.Sprintf(common.WSUrlFormat, hostPort, common.EndpointOpenPublisherStream)
	stream := websocket.NewStreamClient(url, requestHeader, c.wsHub, c.openPublisherOutStreamReadType)
	if err := stream.Start(); err != nil {
		return nil, err
	}
	return NewOpenPublisherOutWebsocketStream(stream), nil
}
func (c *wsConnectorImpl) AcceptPublisherStream(w http.ResponseWriter, r *http.Request) (serverStream.BInOpenPublisherStreamInCall, error) {
	stream := websocket.NewStreamServer(w, r, c.wsHub, c.openPublisherInStreamReadType)
	if err := stream.Start(); err != nil {
		return nil, err
	}
	return NewOpenPublisherInWebsocketStream(stream), nil
}
func (c *wsConnectorImpl) OpenConsumerStream(hostPort string, requestHeader http.Header) (stream.BOutOpenConsumerStreamOutCall, error) {
	url := fmt.Sprintf(common.WSUrlFormat, hostPort, common.EndpointOpenConsumerStream)
	stream := websocket.NewStreamClient(url, requestHeader, c.wsHub, c.openConsumerOutStreamReadType)
	if err := stream.Start(); err != nil {
		return nil, err
	}
	return NewOpenConsumerOutWebsocketStream(stream), nil
}
func (c *wsConnectorImpl) AcceptConsumerStream(w http.ResponseWriter, r *http.Request) (serverStream.BOutOpenConsumerStreamInCall, error) {
	stream := websocket.NewStreamServer(w, r, c.wsHub, c.openConsumerInStreamReadType)
	if err := stream.Start(); err != nil {
		return nil, err
	}
	return NewOpenConsumerInWebsocketStream(stream), nil
}
func (c *wsConnectorImpl) OpenAppendStream(hostPort string, requestHeader http.Header) (serverStream.BStoreOpenAppendStreamOutCall, error) {
	url := fmt.Sprintf(common.WSUrlFormat, hostPort, common.EndpointOpenAppendStream)
	stream := websocket.NewStreamClient(url, requestHeader, c.wsHub, c.openAppendOutStreamReadType)
	if err := stream.Start(); err != nil {
		return nil, err
	}
	return NewOpenAppendOutWebsocketStream(stream), nil
}
func (c *wsConnectorImpl) AcceptAppendStream(w http.ResponseWriter, r *http.Request) (serverStream.BStoreOpenAppendStreamInCall, error) {
	stream := websocket.NewStreamServer(w, r, c.wsHub, c.openAppendInStreamReadType)
	if err := stream.Start(); err != nil {
		return nil, err
	}
	return NewOpenAppendInWebsocketStream(stream), nil
}
func (c *wsConnectorImpl) OpenReadStream(hostPort string, requestHeader http.Header) (serverStream.BStoreOpenReadStreamOutCall, error) {
	url := fmt.Sprintf(common.WSUrlFormat, hostPort, common.EndpointOpenReadStream)
	stream := websocket.NewStreamClient(url, requestHeader, c.wsHub, c.openReadOutStreamReadType)
	if err := stream.Start(); err != nil {
		return nil, err
	}
	return NewOpenReadOutWebsocketStream(stream), nil
}
func (c *wsConnectorImpl) AcceptReadStream(w http.ResponseWriter, r *http.Request) (serverStream.BStoreOpenReadStreamInCall, error) {
	stream := websocket.NewStreamServer(w, r, c.wsHub, c.openReadInStreamReadType)
	if err := stream.Start(); err != nil {
		return nil, err
	}
	return NewOpenReadInWebsocketStream(stream), nil
}
func (c *wsConnectorImpl) OpenReplicationReadStream(hostPort string, requestHeader http.Header) (serverStream.BStoreOpenReadStreamOutCall, error) {
	url := fmt.Sprintf(common.WSUrlFormat, hostPort, common.EndpointOpenReplicationReadStream)
	stream := websocket.NewStreamClient(url, requestHeader, c.wsHub, c.openReadOutStreamReadType)
	if err := stream.Start(); err != nil {
		return nil, err
	}
	return NewOpenReadOutWebsocketStream(stream), nil
}
func (c *wsConnectorImpl) AcceptReplicationReadStream(w http.ResponseWriter, r *http.Request) (serverStream.BStoreOpenReadStreamInCall, error) {
	stream := websocket.NewStreamServer(w, r, c.wsHub, c.openReadInStreamReadType)
	if err := stream.Start(); err != nil {
		return nil, err
	}
	return NewOpenReadInWebsocketStream(stream), nil
}
func (c *wsConnectorImpl) OpenReplicationRemoteReadStream(hostPort string, requestHeader http.Header) (serverStream.BStoreOpenReadStreamOutCall, error) {
	url := fmt.Sprintf(common.WSUrlFormat, hostPort, common.EndpointOpenReplicationRemoteReadStream)
	stream := websocket.NewStreamClient(url, requestHeader, c.wsHub, c.openReadOutStreamReadType)
	if err := stream.Start(); err != nil {
		return nil, err
	}
	return NewOpenReadOutWebsocketStream(stream), nil
}
func (c *wsConnectorImpl) AcceptReplicationRemoteReadStream(w http.ResponseWriter, r *http.Request) (serverStream.BStoreOpenReadStreamInCall, error) {
	stream := websocket.NewStreamServer(w, r, c.wsHub, c.openReadInStreamReadType)
	if err := stream.Start(); err != nil {
		return nil, err
	}
	return NewOpenReadInWebsocketStream(stream), nil
}
func NewOpenPublisherOutWebsocketStream(stream websocket.StreamClient) *OpenPublisherOutWebsocketStream {
	return &OpenPublisherOutWebsocketStream{stream: stream}
}
func (s *OpenPublisherOutWebsocketStream) Write(arg *cherami.PutMessage) error {
	return s.stream.Write(arg)
}
func (s *OpenPublisherOutWebsocketStream) Flush() error {
	return s.stream.Flush()
}