varspool / Wrench
Licence: wtfpl
A simple PHP WebSocket implementation for PHP 7.1
Stars: ✭ 559
Labels
Projects that are alternatives of or similar to Wrench
Microwebsrv
A micro HTTP Web server that supports WebSockets, html/python language templating and routing handlers, for MicroPython (used on Pycom modules & ESP32)
Stars: ✭ 420 (-24.87%)
Mutual labels: websockets
Recorder
Store and access data published by OwnTracks apps
Stars: ✭ 490 (-12.34%)
Mutual labels: websockets
Wsify
Just a tiny, simple and real-time self-hosted pub/sub messaging service
Stars: ✭ 452 (-19.14%)
Mutual labels: websockets
Php Websocket
Simple WebSocket server implemented in PHP.
Stars: ✭ 473 (-15.38%)
Mutual labels: websockets
Script Server
Web UI for your scripts with execution management
Stars: ✭ 506 (-9.48%)
Mutual labels: websockets
Graphql Ws
Coherent, zero-dependency, lazy, simple, GraphQL over WebSocket Protocol compliant server and client.
Stars: ✭ 398 (-28.8%)
Mutual labels: websockets
Getty
a netty like asynchronous network I/O library based on tcp/udp/websocket; a bidirectional RPC framework based on JSON/Protobuf; a microservice framework based on zookeeper/etcd
Stars: ✭ 532 (-4.83%)
Mutual labels: websockets
Seasocks
Simple, small, C++ embeddable webserver with WebSockets support
Stars: ✭ 517 (-7.51%)
Mutual labels: websockets
Simple Websockets Chat App
This SAM application provides the Lambda functions, DynamoDB table, and roles to allow you to build a simple chat application based on API Gateway's new WebSocket-based API feature.
Stars: ✭ 454 (-18.78%)
Mutual labels: websockets
Aws Iot Chat Example
💬 Chat application using AWS IoT platform via MQTT over the WebSocket protocol
Stars: ✭ 474 (-15.21%)
Mutual labels: websockets
Humblenet
a cross-platform networking library that works in the browser
Stars: ✭ 515 (-7.87%)
Mutual labels: websockets
Websocket Manager
Real-Time library for ASP .NET Core
Stars: ✭ 400 (-28.44%)
Mutual labels: websockets
Vue Socket.io Extended
✌️⚡️ Socket.io bindings for Vue.js and Vuex (inspired by Vue-Socket.io)
Stars: ✭ 506 (-9.48%)
Mutual labels: websockets
Gwsocket
fast, standalone, language-agnostic WebSocket server RFC6455 compliant
Stars: ✭ 550 (-1.61%)
Mutual labels: websockets
Rockgo
A developing game server framework,based on Entity Component System(ECS).
Stars: ✭ 532 (-4.83%)
Mutual labels: websockets
Swell
Swell: API development tool that enables developers to test endpoints served over streaming technologies including Server-Sent Events (SSE), WebSockets, HTTP2, GraphQL, and gRPC.
Stars: ✭ 517 (-7.51%)
Mutual labels: websockets
Wrench
Simple WebSocket Client/Server for PHP
- Documentation: wrench.readthedocs.org
A simple websocket server and client package for PHP 7.1.
Installation
The library is PSR-4 compatible, with a vendor name of Wrench. It's available on Composer as wrench/wrench
, so you
can:
composer require wrench/wrench ~3.0
Usage
This creates a server on 127.0.0.1:8000 with one Application that listens for
WebSocket requests to ws://localhost:8000/echo
and ws://localhost:8000/chat
:
Server
/**
* An example application, that just echoes the received data back to the connection that sent it
*/
$app = new class implements \Wrench\Application\DataHandlerInterface
{
public function onData(string $data, \Wrench\Connection $connection): void
{
$connection->send($data);
}
};
// A websocket server, listening on port 8000
$server = new \Wrench\BasicServer('ws://localhost:8000', array(
'allowed_origins' => array(
'mysite.com',
'mysite.dev.localdomain'
)
));
$server->registerApplication('echo', $app);
$server->registerApplication('chat', new \My\ChatApplication());
$server->setLogger($monolog); // PSR3
$server->run();
Client
/**
* A client side example, that sends a string and will receive the data back to the connection that sent it
*/
$client = new Client('ws://localhost:8000, http://localhost:8000);
$client->connect();
$client->sendData('hello');
$response = $client->receive()[0]->getPayload();
$client->disconnect();
Releases and Changelog
See the CHANGELOG for detailed information about changes between releases.
PHP5 Support
The latest major release dropped support for PHP versions prior to 7.1. If you need support for older versions of PHP, see the 2.0 branch. The latest 2.0 branch release is 2.0.8. You can install it with:
composer require wrench/wrench ~2.0
Developing
- Run
./vendor/bin/phpcs
and fix any errors that you come across - Run
./vendor/bin/phpunit --exclude-group large,medium
for a fast test between changes
See Also
- Ratchet an excellent Websocket layer for React.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].