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
Please note this issue appears in ably-go1.2.6 however it doesn't reproduce in 1.2.5
When a Realtime client enters their presence to a brand new channel and there is a short delay before they get channel presence, their client's ID is returned twice.
I've been able to recreate this issue with the following script.
package main
import (
"context"
"fmt"
"os"
"bytes"
"time"
"github.com/ably/ably-go/ably"
)
func main() {
ctx := context.Background()
key, _ := os.LookupEnv("ABLY_PRIVATE_KEY")
client, err := ably.NewRealtime(
ably.WithKey(key),
ably.WithClientID("Client A"),
)
if err != nil {
fmt.Println(err)
return
}
// To recreate the bug set channel name to a new name each time this script is run
// this results in the Get creating a brand new channel rather than fetching an existing channel
myChannel := client.Channels.Get("channel1")
myChannel.Presence.Enter(ctx, nil)
// This bug occurs when there is a delay after entering presence
time.Sleep(time.Second * 5)
presenceMessages, err := myChannel.Presence.Get(ctx)
if err != nil {
fmt.Println(err)
return
}
var buffer bytes.Buffer
for i, msg := range presenceMessages {
if msg != nil {
buffer.WriteString(msg.ClientID)
// if not the last message, add a comma and a space.
if i != len(presenceMessages)-1 {
buffer.WriteString(", ")
}
}
}
fmt.Println(buffer.String())
// When the bug happens in ably-go 1.2.6 "Client A, Client A" is printed
// in ably-go 1.2.5 this script prints "Client A"
}
Please note this issue appears in
ably-go
1.2.6
however it doesn't reproduce in1.2.5
When a Realtime client enters their presence to a brand new channel and there is a short delay before they get channel presence, their client's ID is returned twice.
I've been able to recreate this issue with the following script.
┆Issue is synchronized with this Jira Task by Unito
The text was updated successfully, but these errors were encountered: