Session class
A Zenoh session.
Wraps z_owned_session_t. Use Session.open to create a session,
optionally passing a Config. Call close when done to gracefully
shut down the session and release native resources.
This object holds a native handle, so it cannot cross an isolate
boundary: a copy would share this one's native address while carrying
its own fresh disposal flag, and the second release would be a
use-after-free. Sending it throws ArgumentError naming the class.
⛔ No NativeFinalizer is attached to this class, deliberately: its
release is documented UNDEFINED BEHAVIOUR from a finalizer callback:
z_close drops closures that call Dart_PostCObject_DL, a Dart C API, and
a finalizer callback runs with no current isolate. It is also collected
while its children are still live.
Releasing it explicitly is therefore the only thing that reclaims it.
- Implemented types
- Available extensions
Properties
Methods
-
close(
) → void - Gracefully closes the session and releases native resources.
-
declareAdvancedPublisher(
Object keyExpr, {AdvancedPublisherOptions? options}) → AdvancedPublisher -
Available on Session, provided by the AdvancedSession extension
Declares an advanced publisher on the givenkeyExpr. -
declareAdvancedSubscriber(
Object keyExpr, {AdvancedSubscriberOptions options = const AdvancedSubscriberOptions()}) → AdvancedSubscriber -
Available on Session, provided by the AdvancedSession extension
Declares an advanced subscriber on the givenkeyExpr. -
declareBackgroundLivelinessSubscriber(
Object keyExpr, {bool history = false, bool retainPayload = false}) → Stream< Sample> -
Declares a fire-and-forget background subscriber on liveliness tokens
intersecting
keyExpr. -
declareBackgroundQueryable(
Object keyExpr, {bool complete = false, Locality? allowedOrigin}) → Stream< Query> -
Declares a fire-and-forget background queryable on the given
keyExpr. -
declareBackgroundSubscriber(
Object keyExpr, {Locality? allowedOrigin, bool retainPayload = false}) → Stream< Sample> -
Declares a background subscriber on the given
keyExpr. -
declareKeyExpr(
Object keyExpr) → KeyExpr -
Declares
keyExpron this session and returns an owned KeyExpr. -
declareLivelinessSubscriber(
Object keyExpr, {bool history = false, bool retainPayload = false}) → Subscriber -
Declares a liveliness subscriber on the given
keyExpr. -
declareLivelinessToken(
Object keyExpr) → LivelinessToken -
Declares a liveliness token on the given
keyExpr. -
declarePublisher(
Object keyExpr, {Encoding? encoding, CongestionControl? congestionControl, Priority? priority, bool? isExpress, Locality? allowedDestination, bool enableMatchingListener = false}) → Publisher -
Declares a publisher on the given
keyExpr. -
declarePullLivelinessSubscriber(
Object keyExpr, {required ChannelKind kind, required int capacity, bool history = false, bool retainPayload = false}) → PullSubscriber - Declares a liveliness subscriber whose transitions land in a bounded channel, and returns the shipped PullSubscriber to take them out of.
-
declarePullQueryable(
Object keyExpr, {required ChannelKind kind, required int capacity, bool complete = false, Locality? allowedOrigin}) → PullQueryable - Declares a queryable whose queries land in a bounded channel instead of a stream, and returns a PullQueryable to take them out of.
-
declarePullSubscriber(
Object keyExpr, {ChannelKind kind = ChannelKind.ring, int capacity = 256, Locality? allowedOrigin, bool retainPayload = false}) → PullSubscriber -
Declares a pull subscriber on the given
keyExpr. -
declareQuerier(
Object keyExpr, {QueryTarget target = QueryTarget.bestMatching, ConsolidationMode consolidation = ConsolidationMode.auto, Duration? timeout, CongestionControl? congestionControl, Priority? priority, bool? isExpress, Locality? allowedDestination, ReplyKeyExpr? acceptReplies, bool enableMatchingListener = false}) → Querier -
Declares a querier on the given
keyExpr. -
declareQueryable(
Object keyExpr, {bool complete = false, Locality? allowedOrigin}) → Queryable -
Declares a queryable on the given
keyExpr. -
declareSubscriber(
Object keyExpr, {Locality? allowedOrigin, bool retainPayload = false}) → Subscriber -
Declares a subscriber on the given
keyExpr. -
deleteResource(
Object keyExpr, {Timestamp? timestamp, CongestionControl? congestionControl, Priority? priority, bool? isExpress, Locality? allowedDestination}) → void -
Deletes a resource on the given
keyExpr. -
get(
Object selector, {String? parameters, ZBytes? payload, Encoding? encoding, ZBytes? attachment, QueryTarget target = QueryTarget.bestMatching, ConsolidationMode consolidation = ConsolidationMode.auto, Duration? timeout, CongestionControl? congestionControl, Priority? priority, bool? isExpress, Locality? allowedDestination, ReplyKeyExpr? acceptReplies, bool retainPayload = false}) → Stream< Reply> -
Sends a query on the given
selectorand returns a stream of replies. -
livelinessGet(
Object keyExpr, {Duration? timeout, bool retainPayload = false}) → Stream< Reply> -
Queries liveliness tokens matching the given
keyExpr. -
newTimestamp(
) → Timestamp - Creates a new timestamp from this session's HLC clock.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
peersZid(
) → List< ZenohId> - Returns the ZenohIds of all connected peers.
-
pullGet(
Object selector, {required ChannelKind kind, required int capacity, String? parameters, ZBytes? payload, Encoding? encoding, ZBytes? attachment, QueryTarget target = QueryTarget.bestMatching, ConsolidationMode consolidation = ConsolidationMode.auto, Duration? timeout, CongestionControl? congestionControl, Priority? priority, bool? isExpress, Locality? allowedDestination, ReplyKeyExpr? acceptReplies, bool retainPayload = false}) → PullReplies - Sends a query whose replies land in a bounded channel instead of a stream, and returns a PullReplies handle to take them out of.
-
pullLivelinessGet(
Object keyExpr, {required ChannelKind kind, required int capacity, Duration? timeout, bool retainPayload = false}) → PullReplies - Queries liveliness tokens, with replies landing in a bounded channel instead of a stream.
-
put(
Object keyExpr, String value, {Encoding? encoding, ZBytes? attachment, Timestamp? timestamp, CongestionControl? congestionControl, Priority? priority, bool? isExpress, Locality? allowedDestination}) → void -
Publishes a string
valueon the givenkeyExpr. -
putBytes(
Object keyExpr, ZBytes payload, {Encoding? encoding, ZBytes? attachment, Timestamp? timestamp, CongestionControl? congestionControl, Priority? priority, bool? isExpress, Locality? allowedDestination}) → void -
Publishes a ZBytes
payloadon the givenkeyExpr. -
routersZid(
) → List< ZenohId> - Returns the ZenohIds of all connected routers.
-
toString(
) → String -
A string representation of this object.
inherited
-
undeclareKeyExpr(
KeyExpr keyExpr) → void -
Undeclares
keyExprfrom this session, releasing its numerical id.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited