An open API service indexing awesome lists of open source software.

https://github.com/octamp/wamp

Wamp v2 Implementation
https://github.com/octamp/wamp

high-availability messaging openswoole swoole wamp wamp-protocol wamp-router websocket

Last synced: 5 months ago
JSON representation

Wamp v2 Implementation

Awesome Lists containing this project

README

          

# Octamp Wamp

Octamp WAMP is Router implementation of WAMP Protocol that scalable.

This was implemented using PHP OpenSwoole

Currently, the Adapter use for this is Redis.

## Why Use Octamp Wamp

Octamp Wamp is created using PHP with OpenSwoole instead of Ratchet / React PHP.

Octamp Wamp also support Horizontal Scaling with the help of Redis.

Session data and Wamp Datas will be save in Redis so that all node / server can access it.

### Comparison with other Implementation

| | Octamp Wamp | Thruway |
|---------------------|-------------|---------|
| Horizontal Scalling | ✓ | ✗ |
| Uses OpenSwoole | ✓ | ✗ |
| Uses React PHP | ✗ | ✓ |

## Profile

Octamp Wamp currently implemented using [Basic Profile and Advance Profile](https://wamp-proto.org/wamp_latest_ietf.html) and of WAMP Proto.

## How to use

### Prerequisite

- PHP 8.2
- Redis Stack with Pub/Sub
- Openswoole

### Installation

```shell
composer create-project octamp/wamp ./wamp
cd ./wamp
```

This will create the project in wamp folder

You can update the file `/configs/adapter.yml` or copy to different file

And update the configuration
```yaml
adapter:
type: redis
host: 0.0.0.0
port: 6379
# -- Uncomment the auth if you need username and password
# auth:
# username:
# password:
#
# -- Uncomment options if you need to include other redis option such as database
options:
database: 0
```

You can update the file `/configs/transport.yml` or copy to different file

And update the configuration
```yaml
transports:
- endpoint:
type: tcp
port: 8080
auths:
- method: anonymous
type: static

# -- You can add more method, such us the examples below
# - method: ticket
# type: dynamic
# authenticator: testing
# authenticatorRealm: realm1
# realms:
# - realm1
# - method: wampcra
# type: static
# users:
# - authid: auth
# secret: qa2/QVmmjSx1JJuyH5EI2gMDQf+ARnfwMcLOpUfln74=
# role: auth
# salt: salt1
# keylen: 32
# iterations: 1000

```

You can update the file `/configs/realms.yml` or copy to different file

And update the configuration
```yaml
realms:
- name: realm1
```

Copy the file `.env` to `.env.local`

Update the necessary data
```
TRANSPORT_FILE=/configs/transport.yml
ADAPTER_FILE=/configs/adapter.yml
REALM_FILE=/configs/realms.yml
```

Now run the bin/server

```shell
php ./bin/server
```

That will now run the server

## Octamp Wamp Features

- **High performance** - Uses OpenSwoole, network framework based on an event-driven, asynchronous, non-blocking I/O coroutine programming model for PHP.
- **Scalable** - Designed for Horizontal Scalability.
- **WAMP Basic Profile Features** - This project implements most of the basic profile features in WAMP v2.
- **Websocket Transport** - Currently the project only implements websocket transport.
- **Message Serializer** - Accepts JSON and MessagePack.

### Message Serializer

- JSON
- MessagePack

## Basic Profile Feature Support

### Sessions
| Feature | Supported |
|-------------------------|-----------|
| Session Establishment | ✓ |
| Session Close / Closing | ✓ |
| Abort | ✓ |

### Publish and Subscribe
| Feature | Supported |
|-------------------------------|-----------|
| Subscribe | ✓ |
| Unsubscribe | ✓ |
| Subscribe & Unsubscribe Error | ✓ |
| Publish | ✓ |
| Publish Error | ✓ |

### Remote Procedure Calls
| Feature | Supported |
|-------------------------|-----------|
| Register | ✓ |
| Unregister | ✓ |
| Call | ✓ |
| Call / Invocation Error | ✓ |
| Caller Leaving | ✓ |
| Callee Leaving | ✓ |

### Other Features
| Feature | Supported |
|----------------|-----------|
| URI Validation | Partial |

## Advance Profile Feature Support

### Authentication

| Feature | Static | Dynamic |
|------------|---------|---------|
| Anonymous | ✓ | ✓ |
| Ticket | ✓ | ✓ |
| Wamp-CRA | ✓ | ✓ |
| Wamp-SCRA | ✗ | ✗ |
| Cryptosign | ✗ | ✗ |
| TLS | ✗ | ✗ |
| Cookie | ✗ | ✗ |

### Authorization

| Feature | Static |
|---------------|---------|
| Authorization | ✗ |

### RPC Features

| Feature | Status |
|------------------------------------------------|---------|
| Progressive Call Results | ✗ |
| Ignoring Requests for Progressive Call Results | ✗ |
| Progressive Call Results with Timeout | ✗ |
| Progressive Call Invocations | ✗ |
| Call Timeout | ✗ |
| Call Canceling | ✗ |
| Call Re-Routing | ✗ |
| Caller Identification | ✗ |
| Call Trustlevels | ✗ |
| Registration Meta API | ✗ |
| Pattern-based Registration | ✓ |
| Shared Registration | ✓ |
| Sharded Registration | ✗ |
| Registration Revocation | ✗ |
| (Interface) Procedure Reflection | ✗ |

### PubSub Features

| Feature | Status |
|-------------------------------|---------|
| Subscriber Blackwhite Listing | ✓ |
| Publisher Exclusion | ✓ |
| Publisher Identification | ✓ |
| Publication Trustlevels | ✗ |
| Subscription Meta API | ✗ |
| Pattern-based Subscription | ✓ |
| Sharded Subscription | ✗ |
| Event History | ✗ |
| Event Retention | ✗ |
| Subscription Revocation | ✗ |
| Session Testament | ✗ |
| (Interface) Topic Reflection | ✗ |

### Meta API
| Feature | Event | Procedure |
|------------------------|---------|-----------|
| Session Meta API | ✓ | ✓ |
| Registration Meta API | ✓ | ✗ |
| Subscriptions Meta API | ✗ | ✗ |

### Others

| Feature | Status |
|-----------------------------|---------|
| Feature Announcement | ✓ |
| RawSocket Transport | ✗ |
| Batched WebSocket transport | ✗ |
| Call Rerouting | ✗ |
| Payload Passthru Mode | ✗ |

## TODOs

- [ ] Implement CBOR Serializer https://wamp-proto.org/wamp_bp_latest_ietf.html#name-serializers
- [ ] Remove Dependencies from Thruway Common
- [ ] Add OpenSwoole Table Adapter as Data Provider