In response to the several emails I have received in the last two weeks, I have decided to take the time to post the source code for my HTML5 Stock Market simulator written in PHP.
HTML5 Stock Market Simulation in PHP
Update: Source code now available
I’ve posted the project in GitHub under HTML5 stock market simulation.
HTML5 WebSocket Server in PHP
For those of you who have been waiting for me to post the code for this, I apologize for the delay. You can now clone the repository and play around with this stock simulator for yourself. I was just trying out the app a few minutes ago, and I noticed that the latest version of Chrome wasn’t connecting to the PHP server for some reason. The server recognized the connection request, and even maintained the socket opened, but the browser threw some exception. I haven’t looked into it too much due to current time constraints, so someone that finds out something about it please post. The code does work just fine in Safari, though. I have not tested it in Firefox, but I’d assume it’d work fine. If not, make sure that there’s no settings that prevent websocket connections from being established. As far as Internet Explorer 9 is concerned, I haven’t tried it either, but wouldn’t be surprised if it worked with it, too.
So there you have it. There are instructions in the zip file on how to run the application. As far as extending the app, or building different apps using the server, feel free to do whatever you want with it. Although the code was written for a networking class that I took at school, the elegance and clarity of the code was not the priority. Thus, any graphics about a CS460 class, or poor code documentation can be justified for this reason.