func (cs *ClientServerImpl) CreateRequestMessage(input interface{}) ([]byte, error) {
	msg := &RequestMessage{}

	recognizedTypes := cs.GetRecognizedTypes()
	for typeStr, typeVal := range recognizedTypes {
		if reflect.TypeOf(input) == reflect.PtrTo(typeVal) {
			msg.Type = typeStr
			break
		}
	}
	if msg.Type == "" {
		return nil, &UnrecognizedWSRequestType{reflect.TypeOf(input).String()}
	}
	messageData, err := jsonutil.BuildJSON(input)
	if err != nil {
		return nil, &NotMarshallableWSRequest{msg.Type, err}
	}
	msg.Message = json.RawMessage(messageData)

	send, err := json.Marshal(msg)
	if err != nil {
		return nil, &NotMarshallableWSRequest{msg.Type, err}
	}
	return send, nil
}
func (cs *ClientServerImpl) CreateRequestMessage(input interface{}) ([]byte, error) {
	msg := &RequestMessage{}

	recognizedTypes := cs.GetRecognizedTypes()
	for typeStr, typeVal := range recognizedTypes {
		if reflect.TypeOf(input) == reflect.PtrTo(typeVal) {
			msg.Type = typeStr
			break
		}
	}
	if msg.Type == "" {
		return nil, &UnrecognizedWSRequestType{reflect.TypeOf(input).String()}
	}
	messageData, err := jsonutil.BuildJSON(input)
	if err != nil {
		return nil, &NotMarshallableWSRequest{msg.Type, err}
	}
	msg.Message = json.RawMessage(messageData)

	send, err := json.Marshal(msg)
	if err != nil {
		return nil, &NotMarshallableWSRequest{msg.Type, err}
	}
	return send, nil
}
func ( cs * ClientServerImpl ) CreateRequestMessage ( input interface { } ) ( [ ] byte , error ) { msg := & RequestMessage { } recognizedTypes := cs . GetRecognizedTypes ( ) for typeStr , typeVal := range recognizedTypes { if reflect . TypeOf ( input ) == reflect . PtrTo ( typeVal ) { msg . Type = typeStr break } } if msg . Type == " " { return nil , & UnrecognizedWSRequestType { reflect . TypeOf ( input ) . String ( ) } } messageData , err := jsonutil . BuildJSON ( input ) if err != nil { return nil , & NotMarshallableWSRequest { msg . Type , err } } msg . Message = json . RawMessage ( messageData ) send , err := json . Marshal ( msg ) if err != nil { return nil , & NotMarshallableWSRequest { msg . Type , err } } return send , nil }
// CreateRequestMessage creates the request json message using the given input.
// Note, the input *MUST* be a pointer to a valid backend type that this
// client recognises.
CreateRequestMessage creates the request json message using the given input . Note the input * MUST * be a pointer to a valid backend type that this client recognises .