This is a course example for "Application Development Technology", powered by Bailey :)
Server-side browser push technologies have been around for a while in one way or another, ranging from crude browser polling to Flash enabled frameworks. There are so many evolution and mechanics of server-push technologies, including:
- Server streaming
- Polling and long Polling
- Comet
- Web Sockets
- Server-sent Events
In this example, we will use the Web Sockets to build a traditional poker game, known as "Landlord Fighter". The rules of the game can be searched on Baidu.
-
Build the PHP runtime environment. For simplicity, you can download and install phpStudy. (Maybe you need to configure the
listening port
) -
Unzip
orgit clone
this project into the Web-Root folder. eg. D:/phpStudy/WWW -
Run
start_game.bat
to start the WebSocket service. -
Now, you can play the game at http://localhost/Poker.
Some toolkits/libraries were used in this project, including:
- JQuery
- Bootstrap
- AngularJS
- angular-ui-bootstrap
- AngularJS Toaster
- jquery-confirm
- Workerman - This is a PHP Socket framework
Ok, that all, Enjoy!