Skip to content

payden/php-ws

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

php-ws

PHP extension for writing WebSocket servers in PHP.

Autobahn WebSocket Test Suite Report

Build Status

Feel like writing your WebSocket servers in PHP? Why not.

<?php
$ws = new WebSocketServer();
$ws->bind("0.0.0.0", "8080");
$ws->onopen = function($client) {
  echo "New connection: " . $client->sockfd . "\n";
};
$ws->onclose = function($client) {
  echo "Closing connection: " . $client->sockfd . "\n";
};
$ws->onmessage = function($client, $msg) {
  echo "Received message from client (" . $client->sockfd . "): " . $msg->payload . "\n";
  echo "Sending it back...\n";
  $client->sendText($msg->payload);
};
$ws->run();
?>

About

PHP extension for writing WebSocket servers in PHP.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published