ably-go
ably-go copied to clipboard
Add an integration test for REST client publishing on behalf of a Realtime client.
It is possible for a REST client to publish a message on behalf of a realtime client by providing the connection key of the realtime client.
channel := client.Channels.Get("test")
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
err := channel.Publish(ctx, "temperature", "12.7", ably.PublishWithConnectionKey("108yZeOBAB7iva!QQJ2CnCSa6A4ql22-a7443108yZeOBAB7iva"))
We should add an integration test that covers this scenario:
Given that client A is realtime with echo messages set to false.
And client B is a REST client that knows the connection key of client A.
And both clients have performed Get on the same channel name.
When client B publishes a message to the channel and provides the connection key of client A e.g. client B is publishing on behalf of client A
Then client A does not receive the message as echo messages is set to false and the message is originating from a source with the same connection key as client A.