forked from zeromq/gomq
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdealer.go
29 lines (24 loc) · 810 Bytes
/
dealer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package gomq
import "github.com/myzhan/gomq/zmtp"
// DealerSocket is a ZMQ_DEALER socket type.
// See: https://rfc.zeromq.org/spec:28
type DealerSocket struct {
*Socket
}
// NewDealer accepts a zmtp.SecurityMechanism and an ID.
// It returns a DealerSocket as a gomq.Dealer interface.
func NewDealer(mechanism zmtp.SecurityMechanism, id string) Dealer {
return &DealerSocket{
Socket: NewSocket(false, zmtp.DealerSocketType, zmtp.SocketIdentity(id), mechanism),
}
}
// Connect accepts a zeromq endpoint and connects the
// dealer socket to it. Currently the only transport
// supported is TCP. The endpoint string should be
// in the format "tcp://<address>:<port>".
func (d *DealerSocket) Connect(endpoint string) error {
return ConnectDealer(d, endpoint)
}
var (
_ Dealer = (*DealerSocket)(nil)
)