When using the Publish method, it effectively creates a []*Message{{Name: name, Data: data}} and calls the PublishMultiple.
Given this in the iteration over L608 (where v is type *Message from the passed in slice):
a) one cannot publish any message that bares additional properties (never there is a ClientId property)
b) therefore, the conditional in the snippet above is never evaluated to true
Additionally, and CMIIW, I'm failing to understand the usage of the Publish method with the data being passed as ably.Message (as in realtime_channel_test.go), since what would happen (given the above snippet) if I call publish like so:
Publish(context.Background(), "name", able.Message{Name: "name", Data: "hi", OtherPublicProp: "a"})
... and would effectively create a []*Message{{Name: name, Data: able.Message{Name: "name", Data: "hi", OtherPublicProp: "a"}}, i.e. a Message wrapping the passed in Message, and call PublishMultiple with this slice as param, so even if I wanted to build my own Message with a ClientId, it would be wrapped in a Message that doesn't have a ClientId
While trying to understand how to publish directly to a single subscriber with the realtime channel, I came across this: https://github.com/ably/ably-go/blob/d88b30fdf5dec58a80fa698680dcb8523e2314fc/ably/realtime_channel.go#L596-L613
When using the
Publish
method, it effectively creates a[]*Message{{Name: name, Data: data}}
and calls thePublishMultiple
. Given this in the iteration over L608 (wherev
is type*Message
from the passed in slice):a) one cannot publish any message that bares additional properties (never there is a ClientId property) b) therefore, the conditional in the snippet above is never evaluated to true
Additionally, and CMIIW, I'm failing to understand the usage of the
Publish
method with thedata
being passed asably.Message
(as inrealtime_channel_test.go
), since what would happen (given the above snippet) if I call publish like so:Publish(context.Background(), "name", able.Message{Name: "name", Data: "hi", OtherPublicProp: "a"})
... and would effectively create a[]*Message{{Name: name, Data: able.Message{Name: "name", Data: "hi", OtherPublicProp: "a"}}
, i.e. a Message wrapping the passed in Message, and callPublishMultiple
with this slice as param, so even if I wanted to build my ownMessage
with aClientId
, it would be wrapped in a Message that doesn't have aClientId
┆Issue is synchronized with this Jira Task by Unito