2017 © Pedro Peláez
 

library client

Thruway WAMP client

image

thruway/client

Thruway WAMP client

  • Monday, April 9, 2018
  • by mbonneau
  • Repository
  • 2 Watchers
  • 8 Stars
  • 38,647 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 3 Forks
  • 3 Open issues
  • 8 Versions
  • 32 % Grown

The README.md

Build Status, (*1)

Thruway

Thruway Client is an open source client for Thruway and the WAMP (Web Application Messaging Protocol), for PHP., (*2)

Thruway uses (reactphp); an event-driven, non-blocking I/O model, perfect for modern real-time applications., (*3)

Supported WAMP Features

Basic Spec read more * Publish and Subscribe * Remote Procedure Calls * Websocket Transport * Internal Transport* * JSON serialization, (*4)

Advanced Spec read more * RawSocket Transport * Authentication * WAMP Challenge-Response Authentication * Custom Authentication Methods * Publish & Subscribe * Subscriber Black and Whitelisting * Publisher Exclusion * Publisher Identification * Remote Procedure Calls * Caller Identification * Progressive Call Results * Caller Exclusion * Canceling Calls, (*5)

* Thruway specific features, (*6)

Requirements

Thruway Client is only supported on PHP 5.6 and up., (*7)

Quick Start with Composer

The below instructions actually install the Thruway Router and Client for test purposes. The client can also be installed without the router in your own project., (*8)

Create a directory for the test project, (*9)

  $ mkdir thruway

Switch to the new directory, (*10)

  $ cd thruway

Download Composer more info, (*11)

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

Download Thruway and dependencies, (*12)

  $ php composer.phar require voryx/thruway

Start the WAMP router, (*13)

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

Thruway is now running on 127.0.0.1 port 9090, (*14)

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., (*15)

Here are some [examples] (https://github.com/tavendo/AutobahnJS#show-me-some-code), (*16)

Here's a plunker that will allow you to run some tests against a local router, (*17)

For AngularJS on the frontend, use the Angular WAMP wrapper., (*18)

The Versions

09/04 2018

dev-master

9999999-dev

Thruway WAMP client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matt Bonneau
by David Dan

client wamp websockets wamp2 autobahn

09/04 2018

0.5.4

0.5.4.0

Thruway WAMP client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matt Bonneau
by David Dan

client wamp websockets wamp2 autobahn

08/03 2018

0.5.3

0.5.3.0

Thruway WAMP client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matt Bonneau
by David Dan

client wamp websockets wamp2 autobahn

17/02 2018

dev-ping-timeout

dev-ping-timeout

Thruway WAMP client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matt Bonneau
by David Dan

client wamp websockets wamp2 autobahn

17/02 2018

0.5.2

0.5.2.0

Thruway WAMP client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matt Bonneau
by David Dan

client wamp websockets wamp2 autobahn

17/02 2018

0.5.1

0.5.1.0

Thruway WAMP client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matt Bonneau
by David Dan

client wamp websockets wamp2 autobahn

12/07 2017

0.6.x-dev

0.6.9999999.9999999-dev

Thruway WAMP client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matt Bonneau
by David Dan

client wamp websockets wamp2 autobahn

06/06 2017

0.5.0

0.5.0.0

Thruway WAMP client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matt Bonneau
by David Dan

client wamp websockets wamp2 autobahn