Netlinx Ajax interface module
ColinTurner
Posts: 5
Hello, just in case any one is interested, I've created an ajax interface that allows control of a Netlinx system from any web browser that supports ajax. Check out: http://home.earthlink.net/~urbtek/downloads.htm
A screen shot of the demo can be seen here: http://home.earthlink.net/~urbtek/images/utAjaxScreenCap.png
I've also created a mode file for the jEdit text editor to support syntax highlighting for the Netlinx language.
If anyone uses the module, please send feedback as to what you think.
Thanks,
++Colin.
A screen shot of the demo can be seen here: http://home.earthlink.net/~urbtek/images/utAjaxScreenCap.png
I've also created a mode file for the jEdit text editor to support syntax highlighting for the Netlinx language.
If anyone uses the module, please send feedback as to what you think.
Thanks,
++Colin.
0
Comments
Note: I really like this type of new development and didnt mean to burn you down or something, just a heads up
I think that's a nice accomplishment btw, even if I don't see many people using it. Congrats.
This cool little device has an Opera-based web browser but no Java VM. So, I couldn't use the standard AMX web control features which needs Java to be installed.
Keep in mind, the sample page I show is just a sample. The idea is you decide which functions you want to perform and use the module to get the communication done. The down-side is that you have to create your own web pages, TP Design won't help you.
++Colin.
I've never seen or been able to think of a good use of XML_TO_VARIABLE.
I don't understand it all but I think I can get this to recieve feedback without polling.
champ
anyway, now i think of it, it's actually very handy for webtablets and things like that, that dont run Java cool
I'm giving up until I actually need to do this.
Oh well, I've learnt some along the way.
This is great. I think there could be alot of applications to use this type of programming. Having programed using .NET.
What about creating a webpage that would run the entire processor.
dt
There is a way to keep the connection open and push data when needed, but support for this in browsers is flaky since it violates the http standard. When I need to keep a page updated, I just set a javascript timer and ask for the shared variable every 5 seconds or so. Not the nicest way of doing things, but it works.
++Colin.
That's a great idea. I haven't used the programming interface with Flash but it might be worth looking into.
++Colin.
I spent hours trying to do the same for the Netlinx master but ran into these problems:
You have to store the Flash.swf file on the master, you can't hard code a Flash web page (as you well know). You'll be able to request and/or send data to the master but when the response comes back from the master it will always be on port 80, which can NOT serve up the Flash.swf file because the Netlinx Java home page is there and you can't get around it. I've talk to an AMX engineer that said they hope to change this in the future.
I lost a large job to Cr***** because of this, the client had to have a internet controlled Flash interface which the dark side could offer because they use Windows.
I don't understand a couple of things which bugs me.
In the HTML file all of the user response handler functions are commented out yet they must be getting called.
Why does the javascript increment the port with each command and where is this done? I can't even find where the value of portid is set.
I hope my questions aren't too basic. As you can probably tell I have never used ajax and very little javascript, but I've never let complete lack of knowledge of a technology stop me from figuring out a problem before.
champ
I'm not sure what you're saying here. I've been serving a Flash interface from a ME260 for several years now without problem. I'm attaching my XML Socket Server module for reference, but I've never had a chance to finish it. Currently it only supports channel commands (on/off/push/release) and variable text. I'm using it to interface with a Flash app, but it could be used by any external application.
Here's the module definition:
Sorry for the lack of documentation. Hopefully someday I'll have the change to finish it and package it up nice.
--D
I'd need to see your XML Socket Server module code and the Flash file to see what you are doing.
I need to be able to install the Flash.SWF file on the master and open a port so the client would just enter an IP to load the Flash interface and have two-way communication with the master.
Are you able to do this with your mod?
Yes. The swf is stored on the master. I have a small "index.htm" file on the master that embeds the flash file to make it easy to launch. The Flash file opens a socket on a user specified port, and then is able to have two-way communication with my XMLSocketServer module.
--D
why wouldnt it work on a NI-X000?
Yuri, the module implements a simple web server. Reading up on the http standard will help you understand what is going on. Contact me offline if you need more help.
++Colin.
I just loaded a flash file onto a v3.12.335 master and was able to serve it up without problems. It's in it's own subdirectory with a small index.htm file. There may be issues with getting it to show on the main Java page (I haven't tried this at all), but the master seems to have no problems serving the file.
I don't quite understand the statement you made on responses from the master to the Flash app always being on port 80. Could you expand on this a little more?
Thanks,
--D
Edit: I didn't notice this when I originally tested, but I just looked at the master and it had automatically added a link on the main Java screen that launches the index.htm file (which in turn opens the flash app).
--D
If you were to send a request command to have the master reply with some data, what network port does the data come back over?
If I open port 55 and send data to the master (192.168.1.51:55) , I can control what ever I want from the Flash interface. The problem arrives when I request data from the master, it always sends data back on port 80, or what ever port you have the server set to on the master.
I need the data sent back on port 55 or be able to get the Flash file to load and communicate on the master's server port without having the java page load when the master sends data request back.
Hope this makes sense to you!
Thank -Gary
--D
regards
m.
Colin Turners utNetlinxAjax interface module...
I installed the utAjax interface module on an NI-700 and it works as intended. However, I'm finding a limit on the maximum allowed size for uploaded files. The issue is that I'm implementing a custom user interface in HTML, but once the file size increases above the 16kb threshold, content stops being rendered on the browser.
Does anybody know how to increase or overcome the file size limitation?
Concatenations like that will hit the 16kB limit. Instead concatenate such strings using the following to work around this limit:
Should allow you to serve up files to about 4GB in size. Kim Burgess was looking at adding a similar function to the Netlinx Common Libraries; might be worth checking there too.
If you want a bit more background on the limitation have a read of http://www.amxforums.com/showthread.php?3410-Data.text-or-Buffer-Problems
link is not available
This work-around works perfectly for port 80.
How can I get the same workaround to work on port 8000, which is the one assigned to the utAjaxFramework?
I had completely forgotten about that. If you want to add it in and submit a pull request on GitHub that would be awesome.