mirror of
https://github.com/absmach/magistrala.git
synced 2026-06-23 04:10:28 +00:00
ef5c253c51
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com> Signed-off-by: dusan <borovcanindusan1@gmail.com> Co-authored-by: Steve Munene <stevenyaga2014@gmail.com>
17 lines
426 B
Go
17 lines
426 B
Go
// Copyright (c) Abstract Machines
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package messaging
|
|
|
|
// ClientIdentity returns the transport client identifier carried by the message.
|
|
// It falls back to Publisher for backward compatibility with older messages.
|
|
func (m *Message) ClientIdentity() string {
|
|
if m == nil {
|
|
return ""
|
|
}
|
|
if clientID := m.GetClientId(); clientID != "" {
|
|
return clientID
|
|
}
|
|
return m.GetPublisher()
|
|
}
|