You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
returnfmt.Errorf("Unable to publish message containing a clientId (%s) that is incompatible with the library clientId (%s)", v.ClientID, id)
}
}
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:
ably-go/ably/realtime_channel.go
Lines 596 to 613 in d88b30f
When using the
Publish
method, it effectively creates a[]*Message{{Name: name, Data: data}}
and calls thePublishMultiple
.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 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
The text was updated successfully, but these errors were encountered: