connecting javascript to php socket to communicate with Flash - javascript

I'm trying to build a projection installation for a university project, I want the audience to be able to communicate with the installation with their mobile phones.
This is what I'm trying to do:
- My Flash application will be running on a computer connected to the internet and will be connected to an XMLSocket hosted on my server.
- I need a javascript page which the audience can visit, mouse clicks (touches) will then send data from the javascript page to the socket server.
- Flash application will receive the data and so on..
Is it possible? I've been looking around for various resources, but they all require a flash app to be on the same page, which is not what I want.
I just need a standalone javascript page to be able to talk to a flash app.
Any suggestions or ideas for possible work arounds will be greatly appreciated.
Many thanks,
Will

Yes definitely possible. The server sits between the two (Flash and JS), they don't need to know each other exist. JS sends data to the server and Flash pulls it down.

I am not sure to fully understand your question.
There is no such thing as a "javascript page", javascript is a... script running in a browser environment.
In the case you want to use an Android/iPhone app environment I don't think you need javascript to do this.
But if what you want is to have a web/wap page accessible to the mobiles, with a user interface, buttons, text field, whatever, which communicates in both directions with your XML socket, you need to build your user interface in HTML, and then to use some javascript to call your XML script and translate the response in the interface. If you have a server, can't you host also your UI there? The cross-domain issue would be avoided, otherwise it's easy enough through any server-side script (PHP?).
So yes it seems very possible, but I don't see what you mean by "they all require a flash app to be on the same page". Here's what I understood: Your Flash app is not what you want to load in the mobiles, it's connected to the server's XML in/out and working fine. You just want an interface communicating with this socket. Right?

Related

Is it possible to using web api and open a local folder? [duplicate]

We are currently looking at porting a enterprise silverlight application over to html5. The major roadblock that we have hit is the ability to open files from the user's local disk. Currently they have a document library which just links to files on their computer that they can open from within the app and view or print out. All that I read is that you can only access the local sandbox of the web app with the html5 file api's. We want to load these files from code.
Does anyone know of any workarounds to this?
Thanks
There is no way for html5 to access local file without user selection. But FSO: FileSystemObject works for IE and MAYBE could be regarded as a work around. But still there are some requirements to meet.
It is possible to use chrome's filesystem API to access files on a users local filesytem. So you'd have to be willing to make this a chrome only application.
Using java you can create a "Signed" applet which has access to the local filesystem. (if the applet is signed you can request filesystm permissions)
then there is a tutorial for accessing methods of your java code directly from javascript here: http://docs.oracle.com/javase/tutorial/deployment/applet/invokingAppletMethodsFromJavaScript.html
you should be able to perform something similar from silverlight.
There is no workaround in pure HTML5/Javascript. You need the use of plugins, such as Java or Silverlight (maybe you shouldn't port it after all). As for workarounds, HTML5 gives you an easy way drag and drop multiple files that you could transfer on the server and then display back to your users. Another workaround would be to install a custom agent (a software with only a tray icon) that would send the information about the current user "document library" to server and then again, you could display it back to the user.
Note: I've heard somewhere that browsers will eventually stop supporting plugins. http://www.howtogeek.com/179213/why-browser-plug-ins-are-going-away-and-whats-replacing-them/
Ya, I agree with Markain. However, if you were to limit your audience solely to chrome users, I daresay, you would most likely use some of your users. If Huazhihao is right, then your number of leaving customers should decrease but users who regularly use firefox won't be happy. Overall, I think that this will not work. Otherwise, there would be too many websites that trashed your hard driver (or at least wherever you have the rights to edit/delete files). I think it would be best if your product was setup to synchronize the file whenever an internet connection was detected and a change was made to the file. That way the user would not need to visit the website whenever the file was uploaded. If this is some kind of an error file, then it would be most beneficial if you were to make a link in the application that when clicked, would upload the file to the website and the website were to do whatever was necessary. If this is a purely online thing, then I don't see what business you would have looking through other peoples' files =-). Hope I helped!

Converting simple php web app to LAN only

Apologies if this is not the best tag to use. I'm after some basic thoughts on the best way to do the following without using the net.
I've been asked to build a simple ordering service for a busy takeaway. They're looking for something like you get in McDonalds ie a large screen showing the status of order numbers.
I've created a basic system in php/mysql which consists of 2 pages which look very similar however the staff one has the ability to change the progress when an order item is clicked. The 2nd page is the one that will be displayed on the customer screen and simply queries the database and outputs the results, the page refreshes every 10seconds or so.
The idea is that the customer page will run on a large screen in the restaurant while the staff page will be on a couple of touch screen tablets. As there is no need for internet usage I would like to move this to an internal server but am not sure where to start?
Can I simply setup a server using an old PC, install php and mySqL on it and set it running? Do I then just reference the IP Address of the "server" on the tablets ie something like 192.1.1.1/staffpage.php?
Or is it a bit more complicated than that?
You have the right idea.
I would suggest building a LAMP stack (Linux, Apache, MySQL, PHP) on a cheap linux box. As ivanivan suggested, a Raspberry Pi would be ideal.
There are many tutorials on setting this up with the Pi and Linux.
However, if this is too technical then using an old computer with WAMP/MAMP would also work.
When the server is setup and running on your local network using 127.0.0.1 or localhost, then the ip address of that machine should be reachable by other devices (assuming your firewall allows it).
You could simply load the webpage in a fullscreen browser and use client side javascript to refresh the page every 10 seconds.
Or if you wanted to get clever, you could use ajax or websockets.
On a side note: Another completely different option could be to use a node.js server on a Raspberry Pi and do away with Apache, PHP and Mysql all together.
I hope this helps.
yes you can use the localhost and you need a corn job to refresh the page every 10s

Servier side and client side device detection

We are having two module of same web application in Servlet/jsp. One for mobile and one for desktop. I want to redirect to mobile version whenever an handheld device hit a desktop version. Since I am having two different context of same application, which will be the best approach for this. Server side device detection or client side detection and redirection.
Thanks in advance.
This is no different than redirecting between two different applications (or even two different servers). You might have good reasons for separating it like this, but I would consider having only one application, and using responsive design (media queries) for serving device adapted content. But if you really want to do it as you describe, I would do the detection on the server side, as doing it client side would rely on being able to execute javascript on the client, which may or may not be enabled or blocked.
But whatever approach you choose, please, please, please let the user override this by his/her own wish. And when doing the redirect, please, please, please don't loose the context the user was trying to access in the first place. The worst thing I know are websites that redirect to a mobile website after trying to reach a specific part of the website (typically an article), and then just being redirected to the root of the website, and then having to try to locate the part of the website (article) I was looking for...

HTML/Javascript/CSS Desktop Applications

I have written a program in HTML, Javascript and CSS, and I am displaying it in IE. I'm dependent on IE because data is written to, and read from an Excel File and I need to use ADO for that.
However, the "An activex object is trying to interact with oter parts of the page..." prompt is very irritating, seeing as it is an application that will be store locally on the user's computer, and will not be a web application. I find HTA difficult to debug and it seems as though it hasnt been updated in a while. I can't add my application to trusted sites and use custom level to deal with the activex prompt because it is stored on my computer. I was thinking on storing it on my local host, as I would then be able to add it to trusted site, but this would require adjustments to the user's computer.
Ao my question is, what is the best way for me to display my html/javascript/css program, as a desktop application, with little or no need to change any settings on the user's computer, that could read/write to and from excel spreadsheets (or if you know a better way of dealing with this data), and is stores on the user's couter rather than as a web application?
Any advice would be greatly appreciated:)
Write a windows application instead and use the Apis of excel. Your model of HTML CSS js will not work well with security.

Generating Dynamic web pages without server side scripting

I am trying to control a media device which has lot of multimedia content that it can play using another device(remote control device) like an ipad connected to the LAN. (UPnP)
I want the media device to be able to send the content listing to the remote device so that it will be rendered as a webpage on the remote controller. And actions on the webpages needs to be sent to the the device as commands to execute (like play, pause, next etc). The media device is an embedded device, hence can't have any server side scripting, all has to be done on the client side.
I want the page rendered to be HTML5. So, is it possible to generate dynamic HTML5 pages using just client side scripting?
Thanks a lot.
I am an embedded systems developer hence clueless about the web designing stuff.
Yes, this is possible. I work at Plex, and we have a similar need. Our Plex Media Server is a bunch of C++ software that doesn't build web pages or anything like that, it just serves static files and has API endpoints for controlling media.
I built a media manager that allows configuring the system (but not playback as of now, but the principle is the same) using a web page that is totally static. In fact, we use Cappuccino, which is essentially a JavaScript-only way of building a web page (there's essentially just enough html and css to bootstrap the Cappuccino environment). It uses Ajax to hit the C++ API to do anything else it needs to do.
You might try something similar, but it by no means needs to be Cappuccino - you can do it perfectly well with jQuery, HTML, and CSS.

Categories

Resources