We have a web application. There are physical devices that we need to be able to communicate with, and we have access to all of our clients computers to install whatever software we need. Now, for the question: Is there a way to make this browser-agnostic? As in, not requiring ActiveX controls?
One of my ideas was to install a custom made webserver on each client and then have javascript on our webpage that communicates with that webserver. This could be done by the same way that http://earlz.biz.tm javascript can access subdomains assigned to 127.0.0.1 such as http://loopback.earlz.biz.tm The problem with this of course is that the client's custom made webserver would be forced to run on port 80(which will have conflicts at least sometimes), or we would have to use a nonstandard port for our web application, which is quite undesirable.
Does anyone else have ideas on how to do this?
Just to clarify. Our clients will be using regular PCs with Windows. We need to communicate with physical devices through these PCs. One such thing is a signature pad. So we want for people to be able to sign the signature pad and it show up in the web page.
I don't think browser-based is the solution for this. There are too many security issues. You're better off writing a desktop application that incorporates some web functionality.
I think web servers and possibly comet is the way to go.
Web servers can run on any port you like, as long as there aren't any firewalls blocking the ports, or they are configured to allow http traffic to pass through on different ports. Although theres nothing wrong with just using port 80 either.
On the mini web server you will then need to interact with the device. You mention you are a .net shop, so you will probably have to install linux and apache + mono on these devices - not sure if this is feasible.
Sounds like a great project.
I would try to look at Java Applets...
http://java.sun.com/developer/onlineTraining/Programming/JDCBook/signed.html
"JDK 1.1 signed applets can access local system resources if the local system is properly set up to allow it. See the JDK 1.1 Signed Applet Example page for details."
Related
Are there any built-in methods in Electron / Node.js allowing to transfer a file over local network to another device?
I want to be able to send files locally from one computer to another (through an Electron app), but I also want it to be able to send files to smartphones.
How do I do it? Is it possible to just create a temp local server and download the file from another device by opening the URL (e.g. 192.168.0.x:x/file.txt)?
I tried using https://www.npmjs.com/package/quick-transfer which does exactly that, but for some reason opening the link on another device doesn't do anything.
As painful as it is for me to suggest... I'd recommend WebRTC for this, for these reasons:
It will make a local connection, when possible.
It will work over the internet as well, if required.
You can work around any firewall difficulties with TURN.
You will have compatibility with browsers.
You won't be opening up some server to a file that anyone on the network can get... transmission occurs over a secured connection. (This doesn't mean you can ignore other security aspects in your application however!)
Sample code: https://webrtc.github.io/samples/src/content/datachannel/filetransfer/
Commentary: It's amusing to me that in 2018, we still haven't solved the problem of sending a file from point A to point B. Network Neighborhood in Windows was the golden age, and now it's all screwed up with this newfangled cloud crap. :-) Obligatory: https://xkcd.com/949/
Can anyone explain me the possibilities of creating a web chat (i.e similar to whatsappweb) which works without internet connections the only possible way that these device communicate is either by WiFi or Bluetooth (i.e Peer to peer). If it is not possible on earth could then explain why?
I've come across some javascript files like peer.js. But it uses internet i think. I want it to work without internet connectivity.
Thanks in advance.
With WebRTC it is possible to establish peer-to-peer communication between web-browsers in the same local network: https://developer.mozilla.org/en-US/docs/Web/Guide/API/WebRTC/Peer-to-peer_communications_with_WebRTC
A server is only needed for communication outside of a local network: http://blog.vline.com/post/63765098884/webrtc-if-its-p2p-why-do-i-need-a-server
There is another demonstration in this page: https://hacks.mozilla.org/2013/05/embedding-webrtc-video-chat-right-into-your-website/
However WebRTC is a relatively new system that is not widely supported - so consider it experimental at this stage - but it has the backing of Mozilla, so it might end-up somewhere.
However you are limited to the capabilities that WebRTC provides - and as your code is still JavaScript that runs in the browser you will not have access to any kind of actual networking API (such as Berkeley Sockets) or lower-level control of hardware, such as the ability to create Ad-hoc Wi-Fi networks, new Bluetooth Personal Area Networks, or LE Bluetooth connections... at present.
Google is working on making a Bluetooth API available that runs in the browser. Presently it is only available to Chrome Extensions, but it may soon be available in web-pages in general: https://developers.google.com/web/updates/2015/07/interact-with-ble-devices-on-the-web
Ofcourse there is a way to make this happen. You would have to set up a webserver on the device with this webapp. You could then connect with localhost or 127.0.0.1 . Other people would have to join your hotspot and connect to your ip address.
If you want to connect automaticly you would have to write a real app.
Browsers run in a "contained" mode. No hardware access is possible from any script ran inside the browser, thus there's no way to initialize and setup the device to start direct communication.
I work on embedded devices but am not able to install any software on them (e.g. programs like gdbserver are out). I need to monitor javascript events on those browsers. For example, if we run a web app on the EWB, the device it's on might have a keyboard pop-up. I need a way to see what triggers this event.
I am thinking along the lines of perhaps embedding something into the HTML or javascript that automatically reports any events back to a workstation somewhere.(I already have logs, but they are not live and it's difficult to pinpoint what happens - even beartailing them... wish I could have something like Firebug, but since it's embedded I can't)
Has anyone seen anything along those lines?
To get a debug connection to a web app or page running on a remote device:
Install vorlon using npm
Download ngrok
Start the vorlon server, the server port will probably be localhost:1337 and the following steps assume this
From a terminal/command prompt run ngrok with ngrok http 1337 and it should report an ip address for the other end of the tunnel, something like def01234.ngrok.io available via http and https.
Instead of the local script tag which vorlon suggests, use the remote ngrok address, e.g. <script src="https://def01234.ngrok.io/vorlon.js"></script>. ngrok exposes both http and https - as this is over the public internet I would strongly recommend using a secure connection.
Log onto the vorlon server on your local machine.
If the above test works you are going to want to do two more things:
Get an account at ngrok (or an alternative secure tunnel service) to get a fixed address.
Configure vorlon authentification according to the instructions on this page. By default it is insecure so ANYBODY with the exposed ngrok address could log onto the dashboard and mess with your embedded devices.
I have a Tomcat based server which serves as a Websocket end point (used javax.websocket) for my web based JS app. I am serving out json based data (queried from my database) via the web sockets. I am not using websockets to serve out HTML/JS pages.
Now we are building a native mobile app of our JS web app. There doesnt seem to be good native support for Websockets on Android and ios.
I would like to keep the server code base common to both JS client and the mobile client.
What would be your suggestion for such a situation? Write a different server for mobile clients?
I found this http://www.elabs.se/blog/66-using-websockets-in-native-ios-and-android-apps. They suggest SocketRocket for ios and https://github.com/TooTallNate/Java-WebSocket for Android.
I have never heard of these people / companies. Not sure of their antecedents and if their apps are bug free.
Any suggestions would be welcome.
I'm not sure if this is the answer you are looking for, but I tried this once, and decided to use a webpage that uses the websocket. Each app will display a webview accessing the page. All recent iOS SDK versions support this, but only the newer (4.4+) Androids will.
If you do not want to use webviews, I recommend Tavendo Autobahn for Android. I had a problem that my server's websocket would disconnect all the time. I had to implement a reconnection routine every couple of seconds on the app.
Hope it helps :)
I'm using this library on android for websockets https://github.com/codebutler/android-websockets
Works good with Spring WebSockets.
Sorry for messy answer, I'm in hurry, write in comments if u have questions
I've developed interactive content for a client ( VR Objects ) using javascript and Flash (if needed) that they now want to distribute to prospective customers via a flash drive. That makes it local content causing security issues especially with IE. Actually there doesn't seem to be much problem with any browser except IE. True, IE displays the "allow blocked content" button but they fear that is too complicated or scary. And on IE11 in Win 8.1 it still may not work.
The development environment I use has a way around that for testing using an "embedded web server" although all that seems to do is produce a localhost address such as http://localhost:60331/wyj-01xn/output/surfacide_flash.html. Paste that in the URL bar of any browser on the same machine and you are good. Try it on another machine and no go. So I gather the port address and whatever the /wyj-01xn/ is about are machine specific. Another possible problem -- it may not work easily with IE11 on Win8.1, but I don't personally have that setup to test.
QUESTION: Is there a way I can produce this same functionality for my client, distributed along with the content on the flash drive, without the need to install some special software (local web server) on each client computer??? The current workaround is to tell customers they should us any browser except IE. Client isn't happy.
You could distribute your webpages along with a portable Nginx server, or wrapped inside a Node-webkit or AppJS package.