Sending post message to CODE

Greetings.

By recieving UI_SaveAs post message in my wopi host, I send Action_SaveAs post message, but nothing happens.

Whats wrong with following code?

if(clientmsg.MessageId === 'UI_SaveAs'){
        const msg={
                "MessageId":'Action_SaveAs',
                "SendTime":Date.now(),
                "Values": {
                    "Filename": 'testname.txt',
                    "Notify":true
                }
            }
        frameWin.postMessage(JSON.stringify(msg),'*');
    }

Make sure that your have added an eventListener to receive messages from the Wopi Client:

window.addEventListener("message", receiveMessage, false);

And than you should react on the first message ‘App_LoadingStatus’ and send a ‘Host_PostmessageReady’ message back to the client:

			if (msg.MessageId == 'App_LoadingStatus') {
				if (msg.Values) {
					if (msg.Values.Status == 'Document_Loaded') {
						console.log('==== Document loaded ...init viewer...');
						var iframe = document.getElementById('wopi-iframe');
			                        iframe = iframe.contentWindow || (iframe.contentDocument.document || iframe.contentDocument);									                   
                                                 iframe.postMessage(JSON.stringify({ 'MessageId': 'Host_PostmessageReady' }), '*');

					}
				}
				
			}

Find more details here.