This examples bellow shows typical Elephant.io usage to connect to socket.io server.
| Description | Server | Client | 0X | 1X | 2X | 3X | 4X |
|---|---|---|---|---|---|---|---|
| Acknowledgement | serve-ack.js | ack.php | ✅ | ✅ | ✅ | ✅ | ✅ |
| Basic (listening event) | serve-basic.js | basic.php | ✅ | ✅ | ✅ | ✅ | ✅ |
| Sending and receiving binary data | serve-binary-event.js | binary-event.php | ✅ | ✅ | ✅ | ✅ | ✅ |
| Error handling | serve-error-handling.js | error-handling.php | ✅ | ✅ | ✅ | ✅ | ✅ |
| Authentication using handshake | serve-handshake-auth.js | handshake-auth.php | ⛔️ | ⛔️ | ⛔️ | ✅ | ✅ |
Authentication using Authorization header |
serve-header-auth.js | header-auth.php | ⛔️ | ✅ | ✅ | ✅ | ✅ |
| Keep alive | serve-keep-alive.js | keep-alive.php | ✅ | ✅ | ✅ | ✅ | ✅ |
| Polling | serve-polling.js | polling.php | ✅ | ✅ | ✅ | ✅ | ✅ |
| Custom path | serve2-custom-path.js | custom-path.php | ✅ | ✅ | ✅ | ✅ | ✅ |
Ensure Nodejs already installed on your system, then issue:
cd server
npm install
npm startOn another terminal, issue:
cd client
php binary-event.phpA log file named socket.log will be created upon running the example which
contains the log when connecting to socket server.
Install specific version of socket.io package, e.g. for socket.io 0x:
cd server
npm install socket.io@0Run the example as shown above.