Simple and fast chat written with PHP using Websockets.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
wsphp /WSContent fix Aug 12, 2017
README.md minor changes Aug 5, 2017
chat.css minor changes Aug 5, 2017
chat.js /WSContent fix Aug 12, 2017
index.html /WSContent fix Aug 12, 2017

README.md

PHP and WebSockets chat

This is simple HTML chat with the following features:

1) Unlimited number of connections (users).
2) Every user may select his/her nickname and color.
3) There are notifications wher someone has joined or left the chat.
4) Minumum use of PHP.

How to setup it

1) You will need a wsphp server installed.
2) Setup app_path config option to point to app.php
3) Disable cron_path config option as we do not use it.

Information

Network communications are done using Websockets. WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection. That is why we can read (via ws.onmessage callback) and send messages (via ws.send) using only one websocket connection. WSPHP server takes care about websocket protocol actions: handshake, encoding/decoding frames, etc. PHP role is small - it just re-sends received message to all connected users. Messages are wrapped to JSON format for convenience.