0

I have a JS/HTML frontend and a C++ backend, all using ATL/WTL.

What I am trying to achieve is to create a bidirectional communication between them both, I already am able to call JS functions from C++ backend but I'm finding troubles when I try to send data from JS frontend.

I'm not trying to use a C++ library to extend functionality of HTML/JS, rather I'm trying to access data and methods of the C++ backend which embeds the HTML/JS windows. It is necessary to achieve bidirectional communication between the existing backend and the desired HTML frontend.

Any ideas?

Pablo Stark
  • 682
  • 10
  • 34

2 Answers2

0

I would use Ajax on frontend, then use the proper function on backend.

Check this way: Ajax on JQuery

On JS, get example:

$.get(page, function(data) {
            // Do whatever u want with the data received. (JSON, HTML, ETC)
        });

Do not forget to import jquery:

<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
</head>
agastalver
  • 1,036
  • 8
  • 13
0

I think you are meeting the problem " Cross language Client". You can't call directly Js -> C++ , so we need you mid-service like "message broker" or Websockets

JS -> MID-SERVICE -> C++

2 ways you can try

1.You can use ActiveMQ for Client C++.
You need code one module to communicate to ActiveMQ by C++
And use amq_js lib for Javascript . Read more in http://activemq.apache.org/ajax.html

2. Make websockets using C++;
And make connection from front-end side .

Hope it helps you.

LogPi
  • 706
  • 6
  • 11