Keep connection alive

Recommend this page to a friend!

      PHP Serial  >  All threads  >  Keep connection alive  >  (Un) Subscribe thread alerts  
Subject:Keep connection alive
Summary:Keep connection alive
Messages:2
Author:John Musbach
Date:2009-01-12 14:41:45
Update:2009-01-17 01:10:36
 

  1. Keep connection alive   Reply   Report abuse  
Picture of John Musbach John Musbach - 2009-01-12 14:41:45
Hello, we are trying to use this class such that we have a page with buttons that query the class API so that a serial port connected robot can be moved by the buttons. But since opening the serial port takes a while we'd like to be able to open the port once and keep it open while the person is on the page with the manipulation buttons, how would this be done? Thanks!

  2. Re: Keep connection alive   Reply   Report abuse  
Picture of Matt Switlik Matt Switlik - 2009-01-17 01:10:36 - In reply to message 1 from John Musbach
I'm planning on having a 'server.php' and 'client.php' script in my project. I use jQuery (or some other AJAX javascript framework) to post and receive data from 'server.php'(script that talk to the port) for 'client.php'(the page the web browser loads). I'm planning on opening and closing the port per action request. I'll be communicating with an Arduino board and another custom serial IO board. If you wanted to keep the port open for an extended amount of time you could have a 'port.php' file with a infinite loop and a php script time out of infinity. you'll need a quit command and a way to talk to the script while it's running. Maybe the $_SESSION or a table in the Database, not really sure if it'll work. Hope you get it working.

 
For more information send a message to info at phpclasses dot org.