HTTP Server Push?
vining
Posts: 4,368
Any one got any insight on sever push? I have the master acting as a web server for iPhone/PC control and everything is working fine. I have 24 buttons per page (configurable) and up to ten pages available. This acts like a normal web page (sort of) so when you push a button it triggers the master (server) and does its thing and then after couple second delay (time for values to change) it sends an amended web page out displaying feedback. My button's turn on that should and I even have level feedback for lights via button shadow levels (100 shades from yellow - black) in the returned html doc.
I was then playing witht he AMX virtual keypad I noticed that their page updates automatically, no page refresh needed, no new get/post required. If someone changes a light for instance from anywhere the display on the iPhone/PC will show it with out initiating another HTTP client/server session so I figured the AMX module must not be closing the server connection after the client connects and therefore is able to PUSH updates to the iPhone/PC any time a value changes. I then figured I could do the same by not closing the connection after serving a page but so far no joy.
Once the password to log on is approved I send a "set-cookie" command which the iPhone/PC happily replies with on subsequent POST/GET's but if I try to leave the server running I think the client is dropping the connection and nothing works.
Anyone been down this road and have any tips/tricks they'd like to share. Are there values to send with the header other than keep alive that will actually keep the connection alive.
TIA
I was then playing witht he AMX virtual keypad I noticed that their page updates automatically, no page refresh needed, no new get/post required. If someone changes a light for instance from anywhere the display on the iPhone/PC will show it with out initiating another HTTP client/server session so I figured the AMX module must not be closing the server connection after the client connects and therefore is able to PUSH updates to the iPhone/PC any time a value changes. I then figured I could do the same by not closing the connection after serving a page but so far no joy.
Once the password to log on is approved I send a "set-cookie" command which the iPhone/PC happily replies with on subsequent POST/GET's but if I try to leave the server running I think the client is dropping the connection and nothing works.
Anyone been down this road and have any tips/tricks they'd like to share. Are there values to send with the header other than keep alive that will actually keep the connection alive.
TIA
0
Comments
which is the same request I get from a new client but at least with this request it includes my cookie so if I see this I send a refresh and not the login page. I can live with this.
In the example it's set to send another "GET" every 15 seconds. I'm sure if I look I can find a timeout feature.
Still not so bad.
I still think the server PUSH is possible since on my web page when it does its refresh you see the broswer is busy refreshing but with the AMX virtual kp single page version you don't get that indication so me thinks their connection stays "alive" and the master is a pusher.
I think I would prefer maintaining an constant connection and just updating the iPhone/PC when values change than every x amount of second sending a get and receiving the entire html regardless of there being chnages or not.
I'd also like to know how the AMX VKP works. If you view source on the keypad you get an xml style sheet which refer to href="http/virtualkeypad.xsl on the master. The index.html in the VP folder on the master is just a redirect to:<meta http-equiv="REFRESH" content = "0; URL=/web/module/VirtualKeypad/com.amx.virtualkeypad/virtualkeypad"/> which I can't find any reference to even if I go up a level from the users folder to where vxWorks and PROG.tkn reside..
I don't supposed AMX would like to share their secrets?
It's much better but I still want to know how the AMX vkp is working.
Could they be using AJAX?
Paul
Actually what I'm doing is just a quick fix since this isn't a proper connection protocol for a GUI. Ideally this should a be an app that maintains a connection and the GUI graphics should live on the GUI and only the FB values that change should be sent, hmmm kind of like the touch panel. Lutron has an iPhone app that work via a telnet conection and it would be so easy for AMX to make their own.
There's also a Network Ping Lite app (free download) that allows you to ping, tracert and open a telnet session where you can log in and control the master. It's a great tool just to have a jobsite.
I did something similar with the last company I worked with except that it was a java applet that looked like the touch panel UI that communicated with the controller, so the page didn't need to refresh. To use html and keep feedback updated I would think that AJAX or some other DHTML method would be needed if refreshes are to be avoided. Java had the benefit of running as an applet in a browser or as a stand alone application on either Mac or PC.
Paul
If you dive into the java module for the vkp you will see everything in there. They are using the jQuery javascript library for an AJAX implimentation and it polls the server once every 3 seconds for updates. From what I've been able to tell the masters use a java based web server (hence the web interface speed boost when you up the duet memory) - http.jar which sits in doc:/LIB/. The management interface is named morpheus and can also be found in there. When you've got the virtual keypad module on your system this is then instantiated and all the assets placed into somewhere in memory that the web server can access, thus the request to /web/module/VirtualKeypad/com.amx.virtualkeypad/virtualkeypad/. This modular web server side of things is interesting as it appears that AMX have put into place a framework where hopefully we may have access to write our own web modules for http based control.
Also, I should add that I have not, and do not intend to ever modify, recompile or repurpose any component of this, or any other AMX software.