Coder Social home page Coder Social logo

yurii-prykhodko-solid / connectanum-dart Goto Github PK

View Code? Open in Web Editor NEW

This project forked from konsultaner/connectanum-dart

0.0 0.0 0.0 678 KB

This is a WAMP client (Web Application Messaging Protocol) implementation for the dart language and flutter projects.

License: MIT License

Dart 100.00%

connectanum-dart's Introduction

connectanum-dart

pub travis codecov

This is a WAMP client implementation for the dart language and flutter projects. The project aims to provide a simple and extensible structure that is easy to use. With this project I want return something to the great WAMP-Protocol community.

WAMP is trademark of Crossbar.io Technologies GmbH.

Find install instructions on pub.dev.

Other Projects

TODOs

  • Multithreading for callee invocations
    • callee interrupt thread on incoming cancellations
  • support auto switch auth methods for methods that need to define fields in the hello. At the moment this is only wamp scram.
  • get the auth id that called a method

Known Issues

If multiple authentication methods are used and wamp scram is one of it, wamp scram needs to be the first one. If not wamp scram will not modify the hello as needed and will eventually fail.

Supported WAMP features

Authentication

  • WAMP-CRA
  • TICKET
  • CRYPTOSIGN
    • ☑ Load putty files
      • ☑ MAC validation
      • ☑ password support
    • ☑ Load open ssh files
      • ☐ file validation
      • ☑ password support
    • ☐ Load pkcs1 files
      • ☐ file validation
      • ☐ password support
    • ☐ Load pkcs8 files
      • ☐ file validation
      • ☐ password support
    • ☑ Load base64 encoded ed25519 private key
    • ☑ Load hex encoded ed25519 private key
  • WAMP-SCRAM
    • ☑ Argon2
    • ☑ PBKDF2

Advanced RPC features

  • ☑ Progressive Call Results
  • ☑ Progressive Calls
  • ☐ Call Timeouts
  • ☑ Call Canceling
  • ☑ Caller Identification
  • ☐ Call Trust Levels
  • ☑ Shared Registration
  • ☐ Sharded Registration
  • ☑ Payload PassThru Mode

Advanced PUB/SUB features

  • ☑ Subscriber Black- and Whitelisting
  • ☑ Publisher Exclusion
  • ☑ Publisher Identification
  • ☐ Publication Trust Levels
  • ☑ Pattern-based Subscriptions
  • ☐ Sharded Subscriptions
  • ☑ Subscription Revocation
  • ☑ Event Retention
  • ☑ Payload PassThru Mode

Transport

  • ☑ WebSockets
  • ☑ RawSockets
  • ☑ RawSockets with large data support (connectanum router only)
  • ☐ E2E encryption

Transport Encoding

  • ☑ JSON
  • ☑ msgpack
  • ☑ CBOR
  • ☐ UBJSON
  • ☐ FlatBuffer

Stream model

The transport contains an incoming stream that is usually a single subscribe stream. A session will internally open a new broadcast stream as soon as the authentication process is successful. The transport stream subscription passes all incoming messages to the broadcast stream. If the transport stream is done, the broadcast stream will close as well. The broadcast stream is used to handle all session methods. The user will never touch the transport stream directly.

Start the client

To start a client you need to choose a transport module and connect it to the desired endpoint. When the connection has been established you can start to negotiate a client session by calling the client.connect() method from the client instance. On success the client will return a session object.

If your transport disconnects the session will invalidate. If reconnect is configured, the session will try to authenticate an revalidate the session again. All subscriptions and registrations will be recovered if possible.

import 'package:connectanum/connectanum.dart';
import 'package:connectanum/json.dart';

final client = Client(
  realm: "my.realm",
  transport: WebSocketTransport(
    "ws://localhost:8080/wamp",
    new Serializer(),
    WebSocketSerialization.SERIALIZATION_JSON
  )
);
final session = await client.connect().first;

RPC

to work with RPCs you need to have an established session.

import 'package:connectanum/connectanum.dart';
import 'package:connectanum/json.dart';

final client = Client(
  realm: "my.realm",
  transport: WebSocketTransport(
    "ws://localhost:8080/wamp",
    new Serializer(),
    WebSocketSerialization.SERIALIZATION_JSON
  )
);
final session = await client.connect().first;

// Register a procedure
final registered = await session.register("my.procedure");
registered.onInvoke((invocation) {
  // to something with the invocation
})

// Call a procedure
await for (final result in session.call("my.procedure")) {
  // do something with the result
}

connectanum-dart's People

Contributors

konsultaner avatar ksdaemon avatar liquidiert avatar oberstet avatar cydrickn avatar imranhakeem avatar joelbm24 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.