Working authenticated connection

This commit is contained in:
2023-09-18 20:58:15 -05:00
parent 11b176dcbc
commit c89756630f
10 changed files with 126 additions and 62 deletions

View File

@ -2,10 +2,10 @@ package dispatcher
import (
"fmt"
"github.com/thesyncim/faye/internal/store"
"github.com/thesyncim/faye/message"
"github.com/thesyncim/faye/subscription"
"github.com/thesyncim/faye/transport"
"github.com/thesyncim/fayec/internal/store"
"github.com/thesyncim/fayec/message"
"github.com/thesyncim/fayec/subscription"
"github.com/thesyncim/fayec/transport"
"log"
"strconv"
"sync"
@ -46,7 +46,7 @@ func NewDispatcher(endpoint string, tOpts transport.Options, ext message.Extensi
}
}
//todo allow multiple transports
// todo allow multiple transports
func (d *Dispatcher) Connect() error {
var err error
if err = d.transport.Init(d.endpoint, &d.transportOpts); err != nil {
@ -166,7 +166,7 @@ func (d *Dispatcher) nextMsgID() string {
return strconv.Itoa(int(atomic.AddUint64(d.msgID, 1)))
}
//sendMessage send applies the out extensions and sends a message throught the transport
// sendMessage send applies the out extensions and sends a message throught the transport
func (d *Dispatcher) sendMessage(m *message.Message) error {
d.extensions.ApplyOutExtensions(m)
return d.transport.SendMessage(m)
@ -180,6 +180,7 @@ func (d *Dispatcher) Subscribe(channel string) (*subscription.Subscription, erro
Subscription: channel,
Id: id,
}
d.extensions.ApplyOutExtensions(m)
if err := d.transport.SendMessage(m); err != nil {
return nil, err