package main import ( "fmt" "github.com/thesyncim/fayec" "github.com/thesyncim/fayec/message" "github.com/thesyncim/fayec/subscription" "time" ) var authorizationToken = "ABC" var authenticationExtension message.Extension = func(message *message.Message) { if message.Channel == "/meta/subscribe" { message.Ext = map[string]string{ "access_token": authorizationToken, "timestamp": string(time.Now().Unix()), } } } func main() { client, err := fayec.NewClient("wss://push.groupme.com/faye", fayec.WithOutExtension(authenticationExtension)) defer client.Disconnect() if err != nil { fmt.Errorf("Error connecting to groupme", err) return } var sub *subscription.Subscription sub, err = client.Subscribe("/user/13685836") if err != nil { panic(err) } err = sub.OnMessage(func(channel string, data message.Data) { fmt.Println(data) }) if err != nil { panic(err) } }