fayec/extensions/getstream.go
Marcelo Pires e70f0f0b52 implement missing client methods
stop gracefully on disconnect
2018-09-06 14:28:54 +02:00

28 lines
602 B
Go

package extensions
import (
"github.com/thesyncim/faye/message"
"github.com/thesyncim/faye/transport"
)
type GetStream struct {
UserID string `json:"user_id,omitempty"`
ApiKey string `json:"api_key,omitempty"`
Signature string `json:"signature,omitempty"`
}
func NewGetStream(apiKey string, signature string) GetStream {
return GetStream{
ApiKey: apiKey,
Signature: signature,
}
}
func (gt GetStream) OutExtension(message *message.Message) {
if message.Channel == string(transport.MetaSubscribe) {
//get useriID
gt.UserID = message.Subscription[1:]
message.Ext = gt
}
}