Call a function of the program from a website, is it possible?
-
Let's say both application installed and website has a login form..
Is it possible somehow from the website send a message to the application to do something specific ( call a function )..As seen from this link (http://doc.qt.digia.com/qt/examples-network.html), this must be possible , but could u help me by giving some tips-links?
-
Hello,
Maybe this link help you : http://doc.qt.digia.com/stable/webkit-formextractor.html
A bit of reading it can not hurt http://beej.us/guide/bgnet/
Regards
-
It depends: A website can run arbitrary code on the web server. Of course that code can try to talk to an application via the network. Most websites routinely do so: They access a SQL database somewhere on the network.
So if you can put code onto the web server you can indeed trigger your application to actually do something. But for this the host running the application must be accessible to the webserver. Most people connecting to your server won't be: They are behind proxies, using NAT, are firewalled, etc.
If you are using your own Qt webkit widget you can expose objects to the JS engine that it can work with and access those via JS delivered by the web site. This will of course not work when the user is using a normal stand-alone browser. Those will not allow your site to trigger code not considered safe by the browser (with the exception of plugins of course).
-
I will buy my domain&hosting site, so i am able to do anything i want to the site..
The only thing i can think to call a function of the program from a website, is from the website to change a .txt file and basically the program downloads that .txt file every second.. But wouldn't that consume a lot bandwidth to the user's network?
"Tobias Hunger" is it possible to explain a bit more the easiest way to do something else than the txt thing? I mean for example about the Js engine, could u explain that more detailed?
-
Download a file every second? Are you mad? Seriously: Waking up a laptop every second, making sure the wireless LAN is powered up and the HDD spinning is a surefire way to make sure the batteries will not last long. You should add some expensive to compute hash to make sure the txt file was downloaded correctly. That should get you pretty close to finding out how long your battery is going to last in a worst case scenario:-)
Sorry, I am no web expert... no idea how all that new AJAX stuff is done on the server side. Putting a QObject into a qwebpage was pretty trivial when I last tried. I don't remember the details though, so read the docs yourself.
You might want to investigate a jabber or IRC (instant messaging) for the communication, too.
-
Leon,
It seems that you do not take it the right way.What do you do? An IRC client, network game, consume a Web service, a pilot project for a third party application, to enjoy
What is the purpose of the software is complete?
PS : I speak very little English, so excuse.
-
[quote author="Tobias Hunger" date="1353934819"]So if you can put code onto the web server you can indeed trigger your application to actually do something. But for this the host running the application must be accessible to the webserver. Most people connecting to your server won't be: They are behind proxies, using NAT, are firewalled, etc.[/quote]
He could solve this the other way around: Have the local application connect to some application running on the server. The server-side application would open a port and wait for incoming connections from the client-side application. Whether the client application will use polling to get informed about new tasks it is supposed to do or whether the server will push commands over a permanent connection to the client, is up to his decision...
-
I don't know do i sound proffesional in internet programming and u think that with what u said i will be able to achieve what i want... ? :/
bq. Have the local application connect to some application running on the server. The server-side application would open a port and wait for incoming connections from the client-side application.
How to do that? I don't want all the steps, just at least some links that could help me.