Thruway

PHP Client and Router Library for Autobahn and WAMP (Web Application Messaging Protocol) for Real-Time Application Messaging
Alternatives To Thruway
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Crossbar2,038
3 months ago282otherPython
Crossbar.io - WAMP application router
Thruway64963172 years ago33February 18, 202231mitPHP
PHP Client and Router Library for Autobahn and WAMP (Web Application Messaging Protocol) for Real-Time Application Messaging
Wampsharp38352193 months ago95August 30, 202337otherC#
A C# implementation of WAMP (The Web Application Messaging Protocol)
Turnpike246
2 years ago1January 29, 201532mitGo
Go implementation of a WAMP (Web Application Messaging Protocol) client and router
Nexus244112 months ago14September 23, 202321mitGo
Full-feature WAMP v2 router and client written in Go
Minion122
22 years ago9September 07, 20208mitPHP
A Simplified Client for WAMP v2 (Web Application Messaging Protocol) with command line support - PHP WebSocket Made Easy
Wamp.io794210 years ago4May 29, 201313JavaScript
An implementation of the Autobahn WebSockets RPC/PubSub: WebSocket Application Messaging Protocol (WAMP) for WebSocket.IO or Engine.IO
Spell64
110 months ago2September 14, 201511apache-2.0Elixir
Spell is a Web Application Messaging Protocol (WAMP) client implementation in Elixir. WAMP is an open standard WebSocket subprotocol that provides two application messaging patterns in one unified protocol: Remote Procedure Calls + Publish & Subscribe: http://wamp.ws/
Clj Wamp55
38 years ago16October 05, 20156epl-1.0Clojure
WebSocket Application Messaging Protocol (WAMP) for Clojure and HTTP Kit
Wampire291a year ago5June 01, 20224mitRust
Asynchronous Rust implementation of a WAMP (Web Application Messaging Protocol) client and router
Alternatives To Thruway
Select To Compare


Alternative Project Comparisons
Readme

Build Status

Thruway

Thruway is an open source client and router implementation of WAMP (Web Application Messaging Protocol), for PHP. Thruway uses an event-driven, non-blocking I/O model (reactphp), perfect for modern real-time applications.

Supported WAMP Features

Basic Spec read more

  • Publish and Subscribe
  • Remote Procedure Calls
  • Websocket Transport
  • Internal Transport*
  • JSON serialization

Advanced Spec read more

  • RawSocket Transport
  • Authentication
  • WAMP Challenge-Response Authentication
  • Custom Authentication Methods
  • Authorization
  • Publish & Subscribe
  • Subscriber Black and Whitelisting
  • Publisher Exclusion
  • Publisher Identification
  • Subscriber Meta Events
  • Event History*
  • Subscription Matching
  • Prefix matching
  • Remote Procedure Calls
  • Caller Identification
  • Progressive Call Results
  • Distributed Registrations & Calls*
  • Caller Exclusion
  • Canceling Calls

* Thruway specific features

Requirements

Thruway is only supported on PHP 5.6 and up.

Quick Start with Composer

Create a directory for the test project

  $ mkdir thruway

Switch to the new directory

  $ cd thruway

Download Composer more info

  $ curl -sS https://getcomposer.org/installer | php

Download Thruway and dependencies

  $ php composer.phar require voryx/thruway

If you're going to also use the Thruway Client install a client transport. You'll need this to run the examples

  $ php composer.phar require thruway/pawl-transport

Start the WAMP router

  $ php vendor/voryx/thruway/Examples/SimpleWsRouter.php

Thruway is now running on 127.0.0.1 port 9090

PHP Client Example

<?php

require __DIR__ . '/vendor/autoload.php';

use Thruway\ClientSession;
use Thruway\Peer\Client;
use Thruway\Transport\PawlTransportProvider;

$client = new Client("realm1");
$client->addTransportProvider(new PawlTransportProvider("ws://127.0.0.1:9090/"));

$client->on('open', function (ClientSession $session) {

    // 1) subscribe to a topic
    $onevent = function ($args) {
        echo "Event {$args[0]}\n";
    };
    $session->subscribe('com.myapp.hello', $onevent);

    // 2) publish an event
    $session->publish('com.myapp.hello', ['Hello, world from PHP!!!'], [], ["acknowledge" => true])->then(
        function () {
            echo "Publish Acknowledged!\n";
        },
        function ($error) {
            // publish failed
            echo "Publish Error {$error}\n";
        }
    );

    // 3) register a procedure for remoting
    $add2 = function ($args) {
        return $args[0] + $args[1];
    };
    $session->register('com.myapp.add2', $add2);

    // 4) call a remote procedure
    $session->call('com.myapp.add2', [2, 3])->then(
        function ($res) {
            echo "Result: {$res}\n";
        },
        function ($error) {
            echo "Call Error: {$error}\n";
        }
    );
});


$client->start();

Javascript Clients

You can also use AutobahnJS or any other WAMPv2 compatible client.

Here are some [examples] (tavendo/AutobahnJS)

Here's a plunker that will allow you to run some tests against a local router

For AngularJS on the frontend, use the Angular WAMP wrapper.

Popular Messaging Projects
Popular Wamp Projects
Popular Messaging Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Php
Router
Messaging
Transport
Wamp
Autobahn