Is it possible to integrate/access Node.JS inside a Qt application? - node.js

More specifically, I have a QWebView inside my Qt application and would like Node.JS to run inside pages displayed inside it. I have a bridge between the web view and my application, so I'm able to run Javascript commands inside the web view which communicate with the application.
I'm wondering if it's possible to make Node.JS available to the web view to use?

Node.js typically starts up a web server of sorts, at least in some of the applications I've tried. So accessing the localhost with the appropriate port name should not be a problem.
So basically, start Node.js on port 9000 for example, then open the webview to http://localhost:9000/ and you should be good to go. If you want to have a headless way to access the webserver or its sockets or rest/soap interfaces, you should be able to do it pretty easily with the QNetworkAccessManager class and its related support classes.
Hope that helps.

Related

How can I receive an event from Electron in a Non-Electron Web Page

I get how to communicate between an electron process and a web page within electron and I have seen examples of that on the web using IPCrenderer
If I have a web page that is completely outside of electron ( in this case a vue.js web application ) - but then I wrap it inside an electron app - how can I receive events from within the web application?
To understand the bigger picture, I have a web application that I want to use mainly on the web, but for one of the pages, I need to be able to send and receive between the web page and barcode scanners / serial scales. I can manage USB events within Electron, I am just unsure what to put in the web page to receive events sent from Electron when it is wrapping the web page.
Thanks for your time.
Have you considered using websockets, with e.g. https://www.npmjs.com/package/ws ? It's the same principle as IPC, but allows two-way communication outside Electron.

How can I convert a HTML template into a Node.JS web app

I'm starting out on my Node.JS journey and I discovered a fantastic boilerplate over at https://github.com/azouaoui-med/pro-sidebar-template. I'm unsure though how to turn the static html into a web app. Just wondering how someone with more experience would do this?
Do I take the html and translate it into a PUG template file? I'm guessing to then make the onclick / links actually run some code, i'd need to point them at the routes setup in the web app?
Sorry to ask such inexperienced questions, web apps seem to take a vastly different approach to the desktop apps i'm familiar with programming
I'm wanting to create a web app that runs on a server, which I will later put on the desktop via electron.
thanks
The project you have is using browser-sync which indirectly uses NodeJS to run a local server and host the web application files.
Do I take the HTML and translate it into a PUG template file?
I am not sure about this question unless you specifically want to use server-side rendering I am not sure I would recommend this to start with especially if you plan to later convert this to a desktop application.
[Note* - Assuming you are referencing this library PUGJS in statements above ]
Now For this requirement I'm wanting to create a web app that runs on a server, which I will later put on the desktop via electron.
This will require you to make your data serving layer which is most commonly called backend separate from that of the data viewing layer which is most commonly referred to as front-end. Thus a case for using the same data layer across different types of clients viz. A web application and/or A desktop application ( electron if you choose so )
Step 1 - Define what sort of web application architecture you want to follow or use. This will be based on your project and business requirements. From what information I have so far I would suggest a simple client-server architecture where your frontend or web-application is the client which makes REST API calls to the backend (API Server) and thus produces a meaningful result.
Step 2 - Start with the creation of 2 projects a frontend where your HTML, CSS JS, etc will be and a simple NodeJS script to serve this static web app when deployed on the server. I am going with NodeJS since the context of this question is suggesting the same.
Step 3 - The other project which will only be an API Server or Backend. This server will provide only REST API to the frontend. This server will talk to the database and provide other services like authentication and logging etc. You can use expressJS for this also in the frontend project.
Here is a simplistic representation of the client-server model which you can reference.
Some additional links for you to digest.
What is the difference between a web application and a client/server application?
https://medium.com/codiumclub/web-application-architecture-part-1-guide-to-become-full-stack-developer-cc9526a3519b

How to embed Google Assistant in web application?

Is it possible to include the google assistant into my local web application so that everyone can use it? I've got a JSF-Application that runs on a local tomcat 7 server. My goal is to change the views by voice. I want to do it with the google assistant sdk.
There is the service sdk (python, all functions) and the library sdk(gPRC (java), general function). I tried the java-client, but the hotword detection only works for the service sdk. I need the hotword detection.
Can I run the service python google assistant and my jsf-app on one tomcat server? I can't get my head around it and need your help.
This is only the first step to my goal. Have you any suggestions?
Hotword detection would be non-trivial to implement. A web application contains two parts: a client, which would be the web browser, and the server, which is your local tomcat server.
Web apps basically work with multiple clients communicating to one server through HTTP requests, primarily through Javascript. Your server then processes this, and the cool thing is that the server can be any language you want.
However, the client cannot directly interact with server-side code. This means that locally running feature like hotword detection on the server cannot be directly controlled by the client. You'd need to use a client-side hotword detection library, which would presumably need to be written in Javascript.

How to make an application and website?

I want to make a chat application in website and desktop application
How can I make that?
Need I use 2 language for that? Like java for app and php for website
Thanks you!!
Sure.
Java for the desktop application (there a lot more possible languages).
Php in the website back-end and HTML (and JavaScript) for the front-end.
There are two ways to achieve this:
1. Peer to peer: the clients connect directly.
2. Use a server with, for example, MySQL to "connect" the applications.

Metro Ui Security Architecture

Does anyone know of any article/publication on the security architecture of Metro app?
For example, can the metro app call an external service. If it can,
under what condition. Will it prompt the user first? And if so will
they be able to change their restriction later and how?
Cross domain scripting in a website is usually considered a big
no-no. But if I were to turn the same code into a metro app (since
presumably they're both written in Html 5 + js), does it mean I can
make ajax calls to any server irrespective of their domain? Is it
even possible to port a website into an app? If so how easy is that?
What about accessing local file system? Or does it have to go
through the contracts to do so?
And this is kind of related but if I were to write a website (not an
app). And the site was opened using Metro IE10, can it subscribe
into the metro specific js events? I guess I'm trying to figure out
how to save cost by doing as little development as possible. I
prefer a website that can target multiple platforms and only target
specific platform for the features that absolutely require it - also
not to thrilled with the idea of having to go through microsoft in
order to publish my app.
Any help appreciated.
Metro applications can call into web services located on other machines, but their ability to interact with the local machine is severely limited.
Similarly, accessing arbitrary parts of the local filesystem is not permitted. If your application has the documents (or music or photos) library permission, it can access the files in those libraries.

Resources