2018-09-05 08:56:45 +00:00
|
|
|
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) {
|
2018-09-06 12:28:54 +00:00
|
|
|
if message.Channel == string(transport.MetaSubscribe) {
|
2018-09-05 08:56:45 +00:00
|
|
|
//get useriID
|
|
|
|
gt.UserID = message.Subscription[1:]
|
|
|
|
message.Ext = gt
|
|
|
|
}
|
|
|
|
}
|