init transport
This commit is contained in:
parent
b8d1d7dc3d
commit
518d141dca
16
client.go
16
client.go
@ -6,9 +6,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type options struct {
|
type options struct {
|
||||||
inExtension message.Extension
|
inExt message.Extension
|
||||||
outExtension message.Extension
|
outExt message.Extension
|
||||||
transport transport.Transport
|
transport transport.Transport
|
||||||
}
|
}
|
||||||
|
|
||||||
var defaultOpts = options{
|
var defaultOpts = options{
|
||||||
@ -36,6 +36,16 @@ func NewClient(url string, opts ...Option) (*Client, error) {
|
|||||||
for _, opt := range opts {
|
for _, opt := range opts {
|
||||||
opt(&c.opts)
|
opt(&c.opts)
|
||||||
}
|
}
|
||||||
|
tops := &transport.Options{
|
||||||
|
Url: url,
|
||||||
|
InExt: c.opts.inExt,
|
||||||
|
OutExt: c.opts.outExt,
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.opts.transport.Init(tops)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
return &c, nil
|
return &c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import "github.com/thesyncim/faye/message"
|
|||||||
type Options struct {
|
type Options struct {
|
||||||
Url string
|
Url string
|
||||||
InExt message.Extension
|
InExt message.Extension
|
||||||
outExt message.Extension
|
OutExt message.Extension
|
||||||
//todo dial timeout
|
//todo dial timeout
|
||||||
//todo read/write deadline
|
//todo read/write deadline
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user