Download the PHP package gevman/s2c-websocket without Composer
On this page you can find all versions of the php package gevman/s2c-websocket. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download gevman/s2c-websocket
More information about gevman/s2c-websocket
Files in gevman/s2c-websocket
Download gevman/s2c-websocket
More information about gevman/s2c-websocket
Files in gevman/s2c-websocket
Vendor gevman
Package s2c-websocket
Short Description One way (server2client) simple WebSocket PHP library
License MIT
Package s2c-websocket
Short Description One way (server2client) simple WebSocket PHP library
License MIT
Please rate this library. Is it a good library?
Informations about the package s2c-websocket
PhpSocket
One way (server2client) simple WebSocket PHP library
Installation (using composer)
Listener methods
Constructor(string $host, int $port, string $path, string $identityParam, bool $ssl)
Create Listener
$host
- server ip or domain$port
- port for server socket$path
- default path for socket connection$identityParam
- parameter to resolve identity$ssl
- if true will be usedwss
protocol, otherwisews
protocol
void listen()
Start listening
void onUpdate(function(array $AllIdentities) {/ /})
Triggers when user connected or disconnected
$AllIdentities
- List of all identities along with params
void onClientConnect(function(array $identity) {/ /})
Triggers when user connected
$identity
- Array of identity params of connected user
void onClientDisconnect(function(array $identity) {/ /})
Triggers when user disconnected
$identity
- Array of identity params of disconnected user
void onMessage(function(array $identities, string $message) {/ /})
Triggers when server sends message
$identities
- List of identities which will receive message$message
- message content
void onError(function(Exception $e) {/ /})
Triggers on error
$host
- Exception object of error
Example
Client side (JavaScript)
Server side (PHP)
Notifier methods
Constructor(string $host, int $port)
Create Notifier
$host
- server ip or domain$port
- port of server socket
bool notify(mixed $message, mixed $to)
Send message to server which will be delivered to listed identities
$message
- Message to send$to
- Identity or list identities to be notified, if empty will be notified all identities
Example
Server side (PHP)
Client side (JavaScript)
For https sites You need use wss
connection, For this You need pass true
for last parameter of Listener constructor and use Apache ProxyPass in Your apache config
All versions of s2c-websocket with dependencies
PHP Build Version
Package Version
Requires
php Version
>=5.4
The package gevman/s2c-websocket contains the following files
Loading the files please wait ....