NOTICE : This project is NOT production ready.
There is no rocket science I have done to achieve this.
As you know the CodeIgniter Directory Structure
There is a folder called CI- -application -third_party -Realtime (I put here Ratchet PHP Websocket Library)
How to use :
Download the code.
You got a database script with name "realtime.sql", just import that script into your database named "realtime" (You may use your name but you have to change database name in CodeIgniter's database.php also.
Put the downloaded code in your web root folder (www or htdocs... whatever it may be).
Change the constant BROADCAST_URL and set it as IP of your own computer.
- Open Command Prompt Move towards your webroot folder. We are having our websocket code at following path in our project.
We have to run that server.php file from command prompt.
Just move to that folder by using "cd" command.
Press enter.. Now you are in that directory specifically, just run following command.
If its error free and noting is populated, then its supposed that you got the success to start the websocket server.
- Now run your ci-ratchet project in browser by hitting url.
Once AngularJS initialize, you can see the Textbox, just start typing and press enter.... VOLLAAAAAAAAA
Check it in another browser for realtime experience.
It has some permission issues on shared hosting, so it will gives throw some error. Check issue @ ratchetphp/Ratchet#409
It will work for sure if you have same user for your VPS and shared hosting space.
What I used?
CodeIgniter 3.x PHP Framework (https://www.codeigniter.com/)
Ratchet - Websocket for PHP (http://socketo.me/) by Chris Boden(@boden_c)
Same functionality using jQuery? => Yes
I have added 3 new files in the same project for better understanding in.