Packages

  • package root
    Definition Classes
    root
  • package akka
    Definition Classes
    root
  • package wamp

    Contains classes, traits, types and functions to be used to write applications based on WAMP - Web Application Messaging Protocol

    Contains classes, traits, types and functions to be used to write applications based on WAMP - Web Application Messaging Protocol

    Client

    Akka Wamp provides you with three distinct Client APIs in the wamp.client package

    • Actor based
    • Future based
    • Stream based

    Router

    Akka Wamp provides you with a basic router implementation in the wamp.router package

    Definition Classes
    akka
  • package client

    Contains classes, traits, types and functions to be used to implement WAMP clients in Scala.

    Contains classes, traits, types and functions to be used to implement WAMP clients in Scala.

    Please refer to the official Akka Wamp User's Guide published online for further details.

    Actors

    Is the low level Client API.

    Futures

    Is the high level Client API

    import akka.actor._
    import akka.wamp.client._
    import com.typesafe.config._
    
    val config = ConfigFactory.load("my.conf")
    val system = ActorSystem("myapp", config)
    val client = Client(system)
    
    client.connect("myrouter").foreach { conn =>
      conn.open("myrealm").foreach { implicit s =>
    
        publish("mytopic", List("paolo", 99))
    
        subscribe("mytopic", (name: String, age: Int) = {
          println(s"$name is $age years old")
        }
    
        call("myprocedure", List("paolo", 99))
    
        register("myprocedure", (name: String, age: Int) => {
          name.length + age
        })
      }
    }

    Streams

    TBD

    Definition Classes
    wamp
    See also

    akka.wamp.client.japi for Java API

  • package japi

    Contains classes to implement clients in Java.

    Contains classes to implement clients in Java.

    ...
    Definition Classes
    client
    Note

    Java API

    See also

    akka.wamp.client

  • Client
  • ClientActor
  • ClientException
  • Connection
  • Macros
  • Publication
  • Registration
  • Session
  • Subscription
c

akka.wamp.client

Session

class Session extends wamp.Session with SessionIdScope

Represents a session attached to a realm.

Open

Instances are created either by invoking the Connection.open or the Client.open method

val conn: Future[Connection] = ...
val session: Future[Session] = conn.flatMap(c => c.open("myrealm"))

Topics

Once the session is open, you can publish to topics.

val publication: Future[Publication] =
  session.flatMap { s =>
    s.publish("mytopic", List("paolo", 40))
  }

Or you can subscribe event consumers to topics.

val subscription: Future[Subscription] =
  session.flatMap { s =>
    s.subscribe("mytopic", event => {
      val publicationId = event.publicationId
      val subscriptionId = event.subscriptionId
      val details = event.details
      val payload = event.payload
      // consume payload content ...
    })
  }

Procedures

Once opened, you can call procedures.

val result: Future[Result] =
  session.flatMap(s => s.call("myprocedure", List("paolo", 99)))

Or you can register invocation handlers as procedures.

val registration: Future[Registration] =
  session.flatMap { s =>
    s.register("myprocedure", invocation => {
      val registrationId = invocation.registrationId
      val details = event.details
      val payload = event.payload
      // handle payload content ...
      // return future of payload ...
    })
  }

Macros

You can subscribe/register lambda consumers/handlers to make your code look more functional ;-)

val subscription: Future[Subscription] =
  session.flatMap { implicit s =>

    publish("mytopic", List("paolo", 40))

    subscribe("mytopic", (name: String, age: Int) => {
      println(s"$name is $age years old")
    })

    register("myprocedure", (name: String, age: Int) => {
      name.length + age
    })
  }
See also

akka.wamp.client.japi.Session

akka.wamp.client.Macros

akka.wamp.messages.DataConveyor

akka.wamp.client

Linear Supertypes
SessionIdScope, IdScope, wamp.Session, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Session
  2. SessionIdScope
  3. IdScope
  4. Session
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def call(procedure: Uri, kwargs: Map[String, Any]): Future[Result]

    Calls the given procedure with the given dictionary of named arguments

    Calls the given procedure with the given dictionary of named arguments

    procedure

    is the procedure to be called

    kwargs

    the dictionary of named arguments

    returns

    the (future of) result

  6. def call(procedure: Uri, args: List[Any]): Future[Result]

    Calls the given procedure with the given list of indexed arguments

    Calls the given procedure with the given list of indexed arguments

    procedure

    is the procedure to be called

    args

    the list of indexed arguments

    returns

    the (future of) result

  7. def call(procedure: Uri): Future[Result]

    Calls the given procedure

    Calls the given procedure

    procedure

    is the procedure to be called

    returns

    the (future of) result

  8. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def close(reason: Uri, details: Dict): Future[Closed]

    Closes this session with the given reason and additional details.

    Closes this session with the given reason and additional details.

    reason

    is the reason to close

    details

    are the details to send

    returns

    the (future of) closed signal

  10. def close(reason: Uri): Future[Closed]

    Closes this session with the given reason and default empty details.

    Closes this session with the given reason and default empty details.

    reason

    is the reason to close

    returns

    the (future of) closed signal

  11. def close(): Future[Closed]

    Closes this session with "wamp.error.close_realm" as reason and default empty details.

    Closes this session with "wamp.error.close_realm" as reason and default empty details.

    returns

    the (future of) closed signal

  12. val connector: ActorRef
    Attributes
    protected
  13. val details: Dict

    Are addtional details about this session as sent by the router

  14. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  16. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. def generate(oldIds: Set[Id], fn: (Id) ⇒ Id): Id
    Attributes
    protected
    Definition Classes
    IdScope
  18. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  19. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  20. val id: Id

    Is this session unique identifier as sent by the router

  21. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  22. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  23. def nextRequestId(excludes: Set[Id]): Id

    Generate the next identifier within this scope excluding the provided ones

    Generate the next identifier within this scope excluding the provided ones

    excludes

    is the identifiers set to be excluded

    returns

    the next identifier

    Definition Classes
    SessionIdScope → IdScope
  24. def nextRequestId(): Id

    Generate the next identifier within this scope

    Generate the next identifier within this scope

    returns

    the next identifier

    Definition Classes
    IdScope
  25. final def notify(): Unit
    Definition Classes
    AnyRef
  26. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  27. def publish(topic: Uri, kwargs: Map[String, Any]): Unit

    Publish to a topic (fire and forget)

    Publish to a topic (fire and forget)

    topic

    is the topic to publish to

    kwargs

    is the dictionary of named arguments to be published

  28. def publish(topic: Uri, args: List[Any]): Unit

    Publish to a topic (fire and forget)

    Publish to a topic (fire and forget)

    topic

    is the topic to publish to

    args

    is the list of indexed arguments to be published

  29. def publish(topic: Uri): Unit

    Publish to a topic (fire and forget)

    Publish to a topic (fire and forget)

    topic

    is the topic to publish to

  30. def publishAck(topic: Uri, kwargs: Map[String, Any]): Future[Publication]

    Publish to a topic (and acknowledge)

    Publish to a topic (and acknowledge)

    topic

    is the topic to publish to

    kwargs

    is the dictionary of named arguments to be published

    returns

    the (future of) publication acknowledgment

  31. def publishAck(topic: Uri, args: List[Any]): Future[Publication]

    Publish to a topic (and acknowledge)

    Publish to a topic (and acknowledge)

    topic

    is the topic to publish to

    args

    is the list of indexed arguments to be published

    returns

    the (future of) publication acknowledgment

  32. def publishAck(topic: Uri): Future[Publication]

    Publish to a topic (and acknowledge)

    Publish to a topic (and acknowledge)

    topic

    is the topic to publish to

    returns

    the (future of) publication acknowledgment

  33. val realm: Uri

    Is the realm this session is attached to

  34. def register(procedure: Uri, handler: (Invocation) ⇒ Future[Payload]): Future[Registration]

    Registers the given invocation handler as the given procedure

    Registers the given invocation handler as the given procedure

    procedure

    is the procedure to register as

    handler

    is the invocation handler which will handle incoming invocations

    returns

    the (future of) registration

    See also

    akka.wamp.client

  35. def subscribe(topic: Uri, consumer: (Event) ⇒ Future[Done]): Future[Subscription]

    Subscribes the given event consumer to the given topic

    Subscribes the given event consumer to the given topic

    topic

    is the topic to subscribe to

    consumer

    is the event consumer which will consume incoming events

    returns

    the (future of) subscription

  36. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  37. def toString(): String
    Definition Classes
    AnyRef → Any
  38. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  39. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  40. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from SessionIdScope

Inherited from IdScope

Inherited from wamp.Session

Inherited from AnyRef

Inherited from Any

Ungrouped