HTML5 WebSockets with PHP (WAMP)

preview_player
Показать описание
This is a demo of a simple HTML5 WebSockets server implemented in PHP. Right now the server simply connects a bunch of users, received messages from each user, then broadcasts the same text to all other clients.

The server follows draft 76. I've tried several (well, only a few were available) articles and tutorials about setting up a custom PHP server, but nothing very helpful. The most helpful one was the one posted at NetTuts, but even that one could only take me so far.

My goal with this for right now, as this is part of a final project I'm working on for a Networking class, is to use the sockets to write an app that simulates stock exchange. Several users will log in and see a few companies whose stock they may purchase, then everything updates for everyone in real time.

What I'm liking about the HTML5 WebSockets is that there is absolutely no need for AJAX. With AJAX, in order for everyone to stay synchronized instantaneously, you'd have to call up the server a lot of times. With the WebSockets, the only think you have to do on your front end (client side) is set up a callback function to handle messages from the server. That's it!

I'll have a detailed tutorial on this, and on my final project once I finish it.

Рекомендации по теме
Комментарии
Автор

Failed to construct 'WebSocket': The URL 'socket.io.js' is invalid.

cronexuken