feat: add client name option for user identification in system events
This commit is contained in:
@@ -31,8 +31,16 @@ public class NatsClientOptions {
|
||||
private var clientCertificate: URL? = nil
|
||||
private var clientKey: URL? = nil
|
||||
private var inboxPrefix: String = "_INBOX."
|
||||
private var clientName: String = ""
|
||||
|
||||
public init() {}
|
||||
|
||||
/// Sets the client name sent to the server during CONNECT.
|
||||
/// This name appears in system events and can be used to identify the client.
|
||||
public func name(_ name: String) -> NatsClientOptions {
|
||||
self.clientName = name
|
||||
return self
|
||||
}
|
||||
|
||||
/// Sets the prefix for inbox subjects used for request/reply.
|
||||
/// Defaults to "_INBOX."
|
||||
@@ -195,7 +203,8 @@ public class NatsClientOptions {
|
||||
clientCertificate: clientCertificate,
|
||||
clientKey: clientKey,
|
||||
rootCertificate: rootCertificate,
|
||||
retryOnFailedConnect: initialReconnect
|
||||
retryOnFailedConnect: initialReconnect,
|
||||
name: clientName
|
||||
)
|
||||
return client
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user