All Projects → eole-io → Sandstone

eole-io / Sandstone

Licence: mit
PHP microframework designed to build a RestApi working together with a websocket server. Build a real time RestApi!

Projects that are alternatives of or similar to Sandstone

Stl.fusion
Get real-time UI updates in Blazor apps and 10-1000x faster API responses with a novel approach to distributed reactive computing. Fusion brings computed observables and automatic dependency tracking from Knockout.js/MobX/Vue to the next level by enabling a single dependency graph span multiple servers and clients, including Blazor apps running in browser.
Stars: ✭ 858 (+775.51%)
Mutual labels:  websockets, real-time, realtime, websocket-server
Ws
Simple to use, blazing fast and thoroughly tested WebSocket client and server for Node.js
Stars: ✭ 17,419 (+17674.49%)
Mutual labels:  websocket, real-time, websocket-server
Beast
HTTP and WebSocket built on Boost.Asio in C++11
Stars: ✭ 3,241 (+3207.14%)
Mutual labels:  websocket, websockets, websocket-server
Sec Api
sec.gov EDGAR API | search & filter SEC filings | over 150 form types supported | 10-Q, 10-K, 8, 4, 13, S-11, ... | insider trading
Stars: ✭ 71 (-27.55%)
Mutual labels:  websocket, websockets, real-time
channeled-dashboard
Repository for the talk `Building real time applications with Django and Channels`
Stars: ✭ 20 (-79.59%)
Mutual labels:  websocket-server, websockets, realtime
soketi
Just another simple, fast, and resilient open-source WebSockets server. 📣
Stars: ✭ 2,202 (+2146.94%)
Mutual labels:  real-time, websockets, realtime
Socketcluster Server
Minimal server module for SocketCluster
Stars: ✭ 70 (-28.57%)
Mutual labels:  websocket, websockets, realtime
Microwebsrv2
The last Micro Web Server for IoTs (MicroPython) or large servers (CPython), that supports WebSockets, routes, template engine and with really optimized architecture (mem allocations, async I/Os). Ready for ESP32, STM32 on Pyboard, Pycom's chipsets (WiPy, LoPy, ...). Robust, efficient and documented!
Stars: ✭ 295 (+201.02%)
Mutual labels:  websocket, websockets, websocket-server
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 (+328.57%)
Mutual labels:  websocket, websockets, websocket-server
Cowboy
Small, fast, modern HTTP server for Erlang/OTP.
Stars: ✭ 6,533 (+6566.33%)
Mutual labels:  websocket, websockets, websocket-server
Awesome Websockets
A curated list of Websocket libraries and resources.
Stars: ✭ 850 (+767.35%)
Mutual labels:  websocket, websockets, websocket-server
Ws Tcp Relay
A simple relay between WebSocket clients and TCP servers
Stars: ✭ 186 (+89.8%)
Mutual labels:  websocket, websockets, websocket-server
Websocket
WSServer is a fast, configurable, and extendable WebSocket Server for UNIX systems written in C (C11).
Stars: ✭ 144 (+46.94%)
Mutual labels:  websocket, websockets, websocket-server
intrinio-realtime-python-sdk
Intrinio Python SDK for Real-Time Stock Prices
Stars: ✭ 79 (-19.39%)
Mutual labels:  real-time, websockets, realtime
Php Wss
Web-socket server/client with multi-process and parse templates support on server and send/receive options on client
Stars: ✭ 117 (+19.39%)
Mutual labels:  websocket, websockets, websocket-server
Websockets
Library for building WebSocket servers and clients in Python
Stars: ✭ 3,724 (+3700%)
Mutual labels:  websocket, websockets, websocket-server
Rtb
Benchmarking tool to stress real-time protocols
Stars: ✭ 35 (-64.29%)
Mutual labels:  websocket, real-time, realtime
Arduinowebsockets
arduinoWebSockets
Stars: ✭ 1,265 (+1190.82%)
Mutual labels:  websocket, websockets, websocket-server
Websocket
A PHP implementation of WebSocket.
Stars: ✭ 54 (-44.9%)
Mutual labels:  websocket, websocket-server
Channelstream
Channelstream is a websocket communication server for web applications
Stars: ✭ 52 (-46.94%)
Mutual labels:  websocket, websockets

Sandstone

Build Status Latest Stable Version Scrutinizer Code Quality SensioLabsInsight License

PHP microframework designed to build a RestApi working together with a websocket server.

Build a real time RestApi!

💬 New (18 April 2018)

I opened a chat channel where you can get help, give feedback, and talk about Sandstone (Mattermost instance):

💬 https://framateam.org/sandstone 💬

Install

composer require eole/sandstone

Usage

Create a Sandstone application

Sandstone is a Silex application with websockets:

$app = new Eole\Sandstone\Application();

Declare a websocket topic

Similar as declaring a Silex route:

$app->topic('chat/{channel}', function ($topicPattern, $arguments) {
    $channelName = $arguments['channel'];

    return new ChatTopic($topicPattern, $channelName);
});

See ChatTopic class here.

Send push notifications

When an endpoint is called on the RestApi, i.e POST /api/articles and update a resource, you can send a push notification to notify this update.

On the RestApi stack:

use Symfony\Component\HttpFoundation\Response;

$app->post('api/articles', function () use ($app) {
    // Dispatch an event on article creation
    $app['dispatcher']->dispatch('article.created', new ArticleEvent());

    return new Response([], 201);
});

// Send all 'article.created' events to push server
$app->forwardEventToPushServer('article.created');

Then on the websocket stack:

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Eole\Sandstone\Websocket\Topic;

class MyWebsocketTopic extends Topic implements EventSubscriberInterface
{
    public static function getSubscribedEvents()
    {
        return [
            'article.created' => 'onArticleCreated',
        ];
    }

    public function onArticleCreated(ArticleEvent $event)
    {
        $this->broadcast([
            'message' => 'An article has just been published: '.$event->title,
        ]);
    }
}

Examples

Working examples from scratch:

Documentation

See the full documentation here

Sandstone documentation

Sandstone edition

You're planning to start a new real-time Rest Api application based on Sandstone?

You may be interested by Sandstone edition.

It already integrates a Sandstone application with a docker environment, a database, debug tools...

Get started with Sandstone edition.

Misc

Articles about Sandstone:

Big picture: https://eole-io.github.io/sandstone-doc/big-picture

Changelog

See Releases page.

License

This library is under MIT License.

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].