Class

akka.wamp.client

Session

Related Doc: package client

Permalink

class Session extends SessionLike with Subscriber with Publisher with Callee with Caller with SessionScope

WAMP sessions are established over a WAMP connection.

import akka.wamp.client._
val client = Client("myapp")

import scala.concurrent.Future
implicit val ec = client.executionContext

val session: Future[Session] =
  client.openSession(
    url = "ws://localhost:8080/ws",
    subprotocol = "wamp.2.json",
    realm = "myapp.realm",
    roles = Set(Roles.publisher)
  )

A session is joined to a realm on a router. Routing occurs only between WAMP sessions that have joined the same realm.

Once got a session, it allows to publish/subscribe events and register/call procedures.

val handler: EventHandler = { event =>
  event.payload.map(p => p.args
}
val subscription: Future[Subscribed] =
  session.flatMap(
    _.subscribe(
      topic = "myapp.topic",
      options = Dict()
    )(handler))
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Session
  2. SessionScope
  3. Scope
  4. Caller
  5. Callee
  6. Publisher
  7. Subscriber
  8. SessionLike
  9. AnyRef
  10. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def call(procedure: Uri, args: List[Any], kwargs: Map[String, Any]): Future[Result]

    Permalink

    Call a procedure

    Call a procedure

    procedure

    is the procedure to call

    args

    is the arguments list of arbitrary types to supply

    kwargs

    is the arguments dictionary of arbitrary types to supply

    returns

    the (future of) result

    Definition Classes
    Caller
  6. def call(procedure: Uri, kwargs: Map[String, Any]): Future[Result]

    Permalink

    Call a procedure

    Call a procedure

    procedure

    is the procedure to call

    kwargs

    is the arguments dictionary of arbitrary types to supply

    returns

    the (future of) result

    Definition Classes
    Caller
  7. def call(procedure: Uri, args: List[Any]): Future[Result]

    Permalink

    Call a procedure

    Call a procedure

    procedure

    is the procedure to call

    args

    is the arguments list of arbitrary types to supply

    returns

    the (future of) result

    Definition Classes
    Caller
  8. def call(procedure: Uri): Future[Result]

    Permalink

    Call a procedure

    Call a procedure

    procedure

    is the procedure to call

    returns

    the (future of) result

    Definition Classes
    Caller
  9. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. def close(reason: Uri = Goodbye.defaultReason, details: Dict = Goodbye.defaultDetails): Future[Transport]

    Permalink

    Close this session with the given reason and detail.

    Close this session with the given reason and detail.

    The client sends a GOODBYE message to the router which will in turn replies with a GOODBYE message.

    ,------.          ,------.
    |Client|          |Router|
    `--+---'          `--+---'
       |     GOODBYE     |
       | ---------------->
       |                 |
       |     GOODBYE     |
       | <----------------
    ,--+---.          ,--+---.
    |Client|          |Router|
    `------'          `------'
    reason

    is the reason to close (default is wamp.error.close_realm)

    details

    are the details to send (default is empty)

    returns

    the (future of) connection

  11. val connection: Transport

    Permalink

    is the WAMP connection

  12. val details: Dict

    Permalink

    This session details

  13. implicit val ec: ExecutionContextExecutor

    Permalink
  14. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  15. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  16. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  18. def handle: Receive

    Permalink
  19. def handleEvents: Receive

    Permalink
    Attributes
    protected
    Definition Classes
    Subscriber
  20. def handleInvocations: Receive

    Permalink
    Attributes
    protected
    Definition Classes
    Callee
  21. def handlePublications: Receive

    Permalink
    Attributes
    protected
    Definition Classes
    Publisher
  22. def handleSubscriptions: Receive

    Permalink
    Attributes
    protected
    Definition Classes
    Subscriber
  23. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  24. val id: SessionId

    Permalink

    This session identifier

  25. def isClosed: Boolean

    Permalink

    If this session is closed

    If this session is closed

    returns

    true or false

  26. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  27. val log: Logger

    Permalink
    Attributes
    protected
  28. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  29. final def nextRequestId(excludes: Set[Id] = Set()): Id

    Permalink
    Attributes
    protected[akka.wamp]
    Definition Classes
    SessionScopeScope
  30. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  31. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  32. def publish(topic: Uri, ack: Boolean, data: List[Any], kwdata: Map[String, Any]): Future[Either[Done, Publication]]

    Permalink

    Publish to a topic

    Publish to a topic

    topic

    is the topic to publish to

    ack

    is the acknowledge boolean switch

    data

    is the data list of arbitrary types to supply

    kwdata

    is the data list of arbitrary types to supply

    returns

    (a future of) either done or publication

    Definition Classes
    Publisher
  33. def publish(topic: Uri, ack: Boolean, kwdata: Map[String, Any]): Future[Either[Done, Publication]]

    Permalink

    Publish to a topic

    Publish to a topic

    topic

    is the topic to publish to

    ack

    is the acknowledge boolean switch

    kwdata

    is the data list of arbitrary types to supply

    returns

    (a future of) either done or publication

    Definition Classes
    Publisher
  34. def publish(topic: Uri, ack: Boolean, data: List[Any]): Future[Either[Done, Publication]]

    Permalink

    Publish to a topic

    Publish to a topic

    topic

    is the topic to publish to

    ack

    is the acknowledge boolean switch

    data

    is the data list of arbitrary types to supply

    returns

    (a future of) either done or publication

    Definition Classes
    Publisher
  35. def publish(topic: Uri, ack: Boolean): Future[Either[Done, Publication]]

    Permalink

    Publish to a topic

    Publish to a topic

    topic

    is the topic to publish to

    ack

    is the acknowledge boolean switch

    returns

    (a future of) either done or publication

    Definition Classes
    Publisher
  36. def publish(topic: Uri): Future[Either[Done, Publication]]

    Permalink

    Publish to a topic

    Publish to a topic

    topic

    is the topic to publish to

    returns

    (a future of) either done or publication

    Definition Classes
    Publisher
  37. def register[T](procedure: Uri, handler: T)(implicit tt: scala.reflect.api.JavaUniverse.TypeTag[T], ct: ClassTag[T]): Future[Registration]

    Permalink

    Register the given procedure URI so that the given scala.Function implementation will be dinamically invoked (via the experimental Scala 2.11 reflection capabilities) on INVOCATION from router.

    Register the given procedure URI so that the given scala.Function implementation will be dinamically invoked (via the experimental Scala 2.11 reflection capabilities) on INVOCATION from router.

    T

    it must be any of the scala.Function types

    procedure

    is the procedure URI the callee wants to register

    handler

    is a partially applied function

    returns

    the (future of) registration

    Definition Classes
    Callee
  38. def register(procedure: Uri, handler: InvocationHandler): Future[Registration]

    Permalink

    Register the given procedure URI so that the given invocation handler will be executed on INVOCATION from router.

    Register the given procedure URI so that the given invocation handler will be executed on INVOCATION from router.

    A callee announces the availability of an endpoint implementing a procedure with a dealer by sending a REGISTER message:

    ,------.          ,------.               ,------.
    |Caller|          |Dealer|               |Callee|
    `--+---'          `--+---'               `--+---'
       |                 |                      |
       |                 |                      |
       |                 |       REGISTER       |
       |                 | <---------------------
       |                 |                      |
       |                 |  REGISTERED or ERROR |
       |                 | --------------------->
       |                 |                      |
       |                 |                      |
       |                 |                      |
       |                 |                      |
       |                 |                      |
       |                 |      UNREGISTER      |
       |                 | <---------------------
       |                 |                      |
       |                 | UNREGISTERED or ERROR|
       |                 | --------------------->
    ,--+---.          ,--+---.               ,--+---.
    |Caller|          |Dealer|               |Callee|
    `------'          `------'               `------'
    procedure

    is the procedure URI the callee wants to register

    handler

    is the handler executed on invocations

    returns

    the (future of) registration

    Definition Classes
    Callee
  39. def schedule[R](initialDelay: FiniteDuration, interval: FiniteDuration, task: (Unit) ⇒ R)(implicit executor: ExecutionContext): Cancellable

    Permalink

    Schedules a task to be run repeatedly with an initial delay and a frequency.

  40. val scheduler: Scheduler

    Permalink

    The Akka ActorSystem scheduler

    The Akka ActorSystem scheduler

    Definition Classes
    Publisher
  41. def subscribe(topic: Uri, handler: EventHandler): Future[Subscription]

    Permalink

    Subscribe to the given topic so that the given handler will be executed on events.

    Subscribe to the given topic so that the given handler will be executed on events.

    ,---------.          ,------.             ,----------.
    |Publisher|          |Broker|             |Subscriber|
    `----+----'          `--+---'             `----+-----'
         |                  |                      |
         |                  |                      |
         |                  |       SUBSCRIBE      |
         |                  | <---------------------
         |                  |                      |
         |                  |  SUBSCRIBED or ERROR |
         |                  | --------------------->
         |                  |                      |
         |                  |                      |
         |                  |                      |
         |                  |                      |
         |                  |      UNSUBSCRIBE     |
         |                  | <---------------------
         |                  |                      |
         |                  | UNSUBSCRIBED or ERROR|
         |                  | --------------------->
    ,----+----.          ,--+---.             ,----+-----.
    |Publisher|          |Broker|             |Subscriber|
    `---------'          `------'             `----------'
    topic

    is the topic the subscriber wants to subscribe to

    handler

    is the handler executed on events

    returns

    the (future of) subscription

    Definition Classes
    Subscriber
  42. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  43. implicit val system: ActorSystem

    Permalink
  44. def tickle(topic: Uri, interval: FiniteDuration, delay: FiniteDuration = Duration.Zero): Future[Cancellable]

    Permalink

    Publish a tick count to a topic with an initial delay and frequency.

    Publish a tick count to a topic with an initial delay and frequency.

    E.g. if you would like a message to be sent immediately and thereafter every 500ms you would set delay=Duration.Zero and interval=Duration(500, TimeUnit.MILLISECONDS)

    topic

    is the topic to publish the tick count to

    interval

    is the interval between two ticks

    delay

    is the initial delay

    Definition Classes
    Publisher
  45. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  46. def unregister(procedure: Uri): Future[Unregistered]

    Permalink

    Unregister from the given topic

    Unregister from the given topic

    procedure

    is the procedure to unregister

    returns

    a (future of) unregistered

    Definition Classes
    Callee
  47. def unsubscribe(topic: Uri): Future[Unsubscribed]

    Permalink

    Unsubscribe from the given topic

    Unsubscribe from the given topic

    topic

    is the topic to unsubscribe from

    returns

    a (future of) unsubscribed

    Definition Classes
    Subscriber
  48. implicit val validator: Validator

    Permalink

    is WAMP types validator

  49. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  50. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  51. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from SessionScope

Inherited from Scope

Inherited from Caller

Inherited from Callee

Inherited from Publisher

Inherited from Subscriber

Inherited from SessionLike

Inherited from AnyRef

Inherited from Any

Ungrouped