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
- Alphabetic
- By Inheritance
- Session
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
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
-
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
-
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
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
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
-
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
-
def
close(): CompletionStage[Closed]
Closes this session with
as reason and default empty details."wamp.error.close_realm"
Closes this session with
as reason and default empty details."wamp.error.close_realm"
- returns
the (future of) closed signal
-
val
details: Dict
Are addtional details about this session as sent by the router
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
val
id: Id
Is this session unique identifier as sent by the router
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
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
-
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
-
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
-
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
-
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
-
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
-
val
realm: Uri
Is the realm this session is attached to
-
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
-
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
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )