I want to use LMS to publish data from the VF page and receive it in Aura Component.

I have an Aura Component and am trying to iframe a Visualforce page in it.

```
<aura:component>
<iframe src='/apex/VFLMS'/>
</aura:component>

```

And am trying to publish the data to the Lightning Message channel from VFPage and subscribe to it in Aura Component.

When I see the output I get `sforce` is not defined.

I don't get the error when I try to use Visualforce standard component and drop the VF page into the standard component in the Lightning App Builder.

I have also made the VFPage be lightning available.

Here is my VF page

```
<apex:page lightningStylesheets="true">

    <!-- tried including api.js and it gives this error → Uncaught ReferenceError: Sfdc is not defined-->
    <button onclick="publishLeadData()"> Publish Msg</button>

    <script>

        var LEAD_DATA_CHANNEL = "{!$MessageChannel.LeadDataMessageChannel__c}";

        function publishLeadData() {

            const message = {
                recordId: '001XXXXXXXXXXX',
                name: "Testing"
            };
            sforce.one.publish(LEAD_DATA_CHANNEL, message);
        }

    </script>

</apex:page>

```

This is the Aura Component

```
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >

    <aura:attribute name="recordValue" type="String" />
    <lightning:messageChannel
                              type="LeadDataMessageChannel__c"
                              onMessage="{! c.handleLeadDataMessage }"

                              />
    <iframe src="/apex/LMSVF" frameborder="0" />

    {! v.recordValue }
</aura:component>

```

And this is the controller.js file

```
({
    handleLeadDataMessage : function(component, event, helper) {
        if (event != null && event.getParams() != null) {
            let params = event.getParams();
            console.log(JSON.stringify(params));
            component.set("v.recordValue", JSON.stringify(params, null, "\t"));
        }
    }
})

```