more transport options

This commit is contained in:
Marcelo Pires 2018-09-11 13:30:07 +02:00
parent 8adb569f0f
commit 27fdd47d29
2 changed files with 9 additions and 5 deletions

View File

@ -3,16 +3,20 @@ package transport
import (
"github.com/thesyncim/faye/message"
"github.com/thesyncim/faye/subscription"
"net/http"
"time"
)
//Options represents the connection options to be used by a transport
type Options struct {
RetryInterval time.Duration
Extensions message.Extensions
//todo dial timeout
//todo read/write deadline
Headers http.Header
RetryInterval time.Duration
DialDeadline time.Duration
ReadDeadline time.Duration
WriteDeadline time.Duration
}
//Transport represents the transport to be used to comunicate with the faye server

View File

@ -56,7 +56,7 @@ func (w *Websocket) Init(endpoint string, options *transport.Options) error {
w.subs2 = map[string][]*subscription.Subscription{}
w.onPublishResponse = map[string]func(message *message.Message){}
w.stopCh = make(chan error)
w.conn, _, err = websocket.DefaultDialer.Dial(endpoint, nil)
w.conn, _, err = websocket.DefaultDialer.Dial(endpoint, options.Headers)
if err != nil {
return err
}