View Full Version : Need help with Reverse AJAX/Comet/Long-Polling

12-03-2013, 11:49 PM
To summarize: How do I post data to xml file on server AND update page with changes to xml file (maybe JSON) asynchronously?

I'm a graphic designer and I'm familiar with HTML/CSS however I need help with Javascript, i've only played around with jQuery. I'm working on a browser-based call screener for radio talk shows. The client will have Call, Drop, and several other functions along with indicators for when something changes on the server/talk show system. These buttons should post data to a web server that is connected to a phone bridge/digital hybrid that's programmed with C code to control the talk show system. Yes, I know, this is way over my head. I've done a similar project that used AJAX and an iFrame that would poll the server every second. That was basically just a remote control. For a 6-12 line talk show screener, we need something more efficient. I've tried looking for samples similar to this and couldn't find anything so I need someone to help walk me through this. I know that web sockets would be most efficient but the developer writing the C-code says that the server he's working on wouldn't support it. It's a Coldfire processor and Netburner software. Does anyone know if this server would be able to support web sockets? Otherwise, I'm left to long-polling. I was hoping I could just post data to an xml or php file on the server and check that same file for changes made from the C code and update the client page with css class changes and javascript that would change text, button states and colors.

To start simple, I just want to send 3 commands (Call, Drop, Hold) and to find out from the server if the line is in use, ringing, or on hold based on a class change and update the client page asynchronously. Eventually it will have to be specific to a phone line and will retrieve calling line ID information. I would like the call/drop buttons to submit via javascript instead of a form so that it doesn't refresh the page at each button push. The server will have several instances of the browser so that people from screen calls from different computers and will have browser-to-browser chat. Therefore people will have to log in. Again, web sockets would be ideal if it's possible. Ideally we hope this will be compatible with all browsers including mobile.

Can anyone walk me though this or point me to someone or an example that would help?

12-13-2013, 11:02 PM
Out of curiosity, assuming that you get your web browser / AJAX controls operational, what will be the bridge between the C program and the web server?

iFrames should be avoided because they do pose a number of issues over the security aspect and access, you would be better to have your AJAX poll the server for data to update a DIV element that works like an iFrame.

01-08-2014, 12:01 AM
The web server will be plugged into the phone bridge/switch core. I'm more of a graphic designer than a developer so I just handle the client side. If I can get the data to the server, the engineer/developer that designed the program does the rest.

Of course, I had no interest in using iFrames.