Packages

class Session extends AnyRef

Represents a session attached to a realm.

Open

Instances can be created by invoking the Connection.open method.

CompletionStage<Connection> conn = ...
CompletionStage<Session> session = conn.thenCompose(c -> c.open("myrealm"));

Topics

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

// import static java.util.Arrays.asList;
CompletionStage<Publication> publication =
  session.thenCompose(s -> {
    s.publish("mytopic", asList("paolo", 40));
  });

Or you can subscribe to topics.

CompletionStage<Subscription> subscription =
  session.thenCompose(s -> {
    s.subscribe("mytopic", event -> {
      Long publicationId = event.publicationId();
      Long subscriptionId = event.subscriptionId();
      Map<String, Object> details = event.details();

      // consume event arguments ...
    });
  });

Procedures

Once opened, you can call procedures.

CompletionStage<Result> result =
  session.thenCompose(s -> s.call("myprocedure", asList("paolo", 99)));

result.whenComplete((res, ex) -> {
  if (res != null) log.info("Result: {}", res);
  else log.error(ex.getMessage(), ex);
})

Or you can register invocation handlers as procedures.

CompletionStage<Registration> registration =
  session.thenCompose(s -> {
    s.register("myproc", invoc -> {
      Long registrationId = invoc.registrationId();
      Map<String, Object> details = invoc.details();

      // handle invocation arguments ...
      // return outgoing payload ...
    });
  });

Macros

Not supported for Java

Note

Java API

See also

akka.wamp.client.Session

akka.wamp.client.japi.DataConveyor

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Session
  2. AnyRef
  3. 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, AnyRef]): CompletionStage[Result]

    Calls the given procedure with the given dictionary of named arguments

    Calls the given procedure with the given dictionary of named arguments

    procedure

    the procedure to be called

    kwargs

    the dictionary of named arguments

    returns

    the (future of) result

  6. def call(procedure: Uri, args: List[AnyRef]): CompletionStage[Result]

    Calls the given procedure with the given list of indexed arguments

    Calls the given procedure with the given list of indexed arguments

    procedure

    the procedure to be called

    args

    the list of indexed arguments

    returns

    the (future of) result

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

    Calls the given procedure

    Calls the given procedure

    procedure

    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: Map[String, AnyRef]): CompletionStage[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): CompletionStage[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(): CompletionStage[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 details: Dict

    Are addtional details about this session as sent by the router

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

    Is this session unique identifier as sent by the router

  19. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  20. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. final def notify(): Unit
    Definition Classes
    AnyRef
  22. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  23. def publish(topic: Uri, kwargs: Map[String, AnyRef]): 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

  24. def publish(topic: Uri, args: List[AnyRef]): 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

  25. 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

  26. def publishAck(topic: Uri, kwargs: Map[String, AnyRef]): CompletionStage[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

  27. def publishAck(topic: Uri, args: List[AnyRef]): CompletionStage[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

  28. def publishAck(topic: Uri): CompletionStage[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

  29. val realm: Uri

    Is the realm this session is attached to

  30. def register(procedure: Uri, handler: Function[Invocation, CompletionStage[Payload]]): CompletionStage[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

  31. def subscribe(topic: Uri, consumer: Function[Event, CompletionStage[Done]]): CompletionStage[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

  32. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  33. def toString(): String
    Definition Classes
    AnyRef → Any
  34. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped