asciiu / akka-wamp

WAMP - Web Application Messaging Protocol implementation written in Scala with Akka HTTP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Akka Wamp

Build Status CodeCov Status Gitter

Akka Wamp is a WAMP - Web Application Messaging Protocol implementation written in Scala with Akka

Easy to download as SBT library dependency.

libraryDependencies ++= Seq(
  "com.github.angiolep" % "akka-wamp_2.11" % "0.12.0"
)  

Client APIs

Connect to a router, open a session, subscribe a topic, receive events, register a procedure and call it in few lines of Scala!

  • Actor, Future and Stream based APIs
  • Well documented and rich examples
  • Lazy and pluggable deserialization

Please, read the docs for further details

import scala.concurrent.duration._
import akka.wamp.client._

object MyClientApp extends App {
  val client = Client()
  implicit val ec = client.executionContext
  
  for {
    session <- client.
      openSession(
        url = "ws://localhost:8080/ws",
        realm = "myapp.realm")
    publication <- session.
      publish(
        topic = "myapp.topic.people",
        ack = true,
        argskw = Map("name"->"paolo", "age"->40))
    subscription <- session.
      subscribe(
        topic = "myapp.topic.any",
        (event) => event.data.map(println))
    registration <- session.
      register(
        procedure = "myapp.procedure.sum", 
        handler = (a: Int, b: Int) => a + b)
    result <- session.
      call(
        procedure = "myapp.procedure.multiply",
        args = List(3, 8)
      )
  } 
  yield ()
}

Router

Download

Akka Wamp provides you with a router that can be either embedded into your application or launched as standalone server process.

Download the latest router version, extract, configure and run it as standalone application:

curl https://dl.bintray.com/angiolep/universal/akka-wamp-0.12.0.tgz
tar xvfz akka-wamp-0.12.0.tar.gz
cd akka-wamp-0.12.0
vim ./conf/application.conf
./bin/akka-wamp -Dakka.loglevel=DEBUG

Please, read the docs for further details

Limitations

  • Scala 2.11 only (no older Scala and no Java yet)
  • WebSocket transport only (no raw TCP and no SSL/TLS yet)
  • Provide WAMP Basic Profile only (no Advanced Profile yet)
  • Provide JSON serialization only (no MsgPack yet)

Changelog

Please, read CHANGELOG.md

Contributing

Please, read CONTRIBUTING.md

Licence

This software comes with Apache License 2.0

Disclaimer

This SOFTWARE PRODUCT is provided by THE PROVIDER "as is" and "with all faults." THE PROVIDER makes no representations or warranties of any kind concerning the safety, suitability, lack of viruses, inaccuracies, typographical errors, or other harmful components of this SOFTWARE PRODUCT. There are inherent dangers in the use of any software, and you are solely responsible for determining whether this SOFTWARE PRODUCT is compatible with your equipment and other software installed on your equipment. You are also solely responsible for the protection of your equipment and backup of your data, and THE PROVIDER will not be liable for any damages you may suffer in connection with using, modifying, or distributing this SOFTWARE PRODUCT

About

WAMP - Web Application Messaging Protocol implementation written in Scala with Akka HTTP

License:Other


Languages

Language:Scala 100.0%