add dispatcher

simplify transport implementation
support wildcard subscriptions
This commit is contained in:
Marcelo Pires
2018-09-24 16:13:57 +02:00
parent 8583e29645
commit 33a61d6d27
13 changed files with 786 additions and 410 deletions

View File

@ -8,7 +8,7 @@ import (
)
func debugJson(v interface{}) string {
b, _ := json.MarshalIndent(v, "", " ")
b, _ := json.MarshalIndent(v, "", " ")
return string(b)
}
@ -20,7 +20,7 @@ type DebugExtension struct {
func NewDebugExtension(out io.Writer) *DebugExtension {
li := log.New(out, "InMsg", 0)
lo := log.New(out, "outMsg", 0)
lo := log.New(out, "OutMsg", 0)
return &DebugExtension{in: li, out: lo}
}

View File

@ -2,7 +2,6 @@ package extensions
import (
"github.com/thesyncim/faye/message"
"github.com/thesyncim/faye/transport"
)
type GetStream struct {
@ -18,10 +17,10 @@ func NewGetStream(apiKey string, signature string) GetStream {
}
}
func (gt GetStream) OutExtension(message *message.Message) {
if message.Channel == string(transport.MetaSubscribe) {
func (gt GetStream) OutExtension(msg *message.Message) {
if msg.Channel == string(message.MetaSubscribe) {
//get useriID
gt.UserID = message.Subscription[1:]
message.Ext = gt
gt.UserID = msg.Subscription[1:]
msg.Ext = gt
}
}