Client class

NATS client

Constructors

Client()
NATS Client Constructor

Properties

acceptBadCert bool
accept bad certificate NOT recomend to use in production
getter/setter pair
connected bool
true if connected
no setter
defaultPubBuffer bool
default buffer action for pub
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
inboxPrefix String
set Inbox prefix default '_INBOX'
getter/setter pair
info Info?
add json encoder for type
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
seed String?
Nkeys seed
getter/setter pair
status Status
status of the client
no setter
statusStream Stream<Status>
Stream status for status update
no setter

Methods

close() Future
close connection to NATS server unsub to server but still keep subscription list at client
connect(Uri uri, {ConnectOption? connectOption, int timeout = 5, bool retry = true, int retryInterval = 10, int retryCount = 3}) Future
Connect to NATS server
forceClose() Future
close connection and cancel all future retries
maxPayload() int?
get server max payload
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
ping() Future
ping server current not implement pong verification
pub(String? subject, Uint8List data, {String? replyTo, bool? buffer, Header? header}) Future<bool>
publish by byte (Uint8List) return true if sucess sending or buffering return false if not connect
pubString(String subject, String str, {String? replyTo, bool buffer = true, Header? header}) Future<bool>
publish by string
registerJsonDecoder<T>(T f(String)) → void
add json decoder for type
request<T>(String subj, Uint8List data, {Duration timeout = const Duration(seconds: 2), T jsonDecoder(String)?}) Future<Message<T>>
Request will send a request payload and deliver the response message, TimeoutException on timeout.
requestString<T>(String subj, String data, {Duration timeout = const Duration(seconds: 2), T jsonDecoder(String)?}) Future<Message<T>>
requestString() helper to request()
sub<T>(String subject, {String? queueGroup, T jsonDecoder(String)?}) Subscription<T>
subscribe to subject option with queuegroup
tcpClose() Future<void>
close tcp connect Only for testing
tcpConnect(String host, {int port = 4222, ConnectOption? connectOption, int timeout = 5, bool retry = true, int retryInterval = 10}) Future
discontinue tcpConnect. use connect(uri) instead Backward compatible with 0.2.x version
toString() String
A string representation of this object.
inherited
unSub(Subscription s) bool
unsubscribe
unSubById(int sid) bool
unsubscribe by id
waitUntil(Status s) Future<void>
wait untril status
waitUntilConnected() Future<void>
wait until client connected

Operators

operator ==(Object other) bool
The equality operator.
inherited