nats/driver.go
func Open(URL ...string) (pubsub.Hub, error) {
	if len(URL) == 0 {
		URL = []string{nats.DefaultURL}
	}

	log.Info("connecting to nats hub: %v", URL)

	conn, err := nats.Connect(URL[0])
	if err != nil {
		return nil, err
	}

	return &hub{
		conn: conn,
		subs: make(map[*sub]struct{}),
	}, nil
}
func Open(URL ...string) (pubsub.Hub, error) {
	if len(URL) == 0 {
		URL = []string{nats.DefaultURL}
	}

	log.Info("connecting to nats hub: %v", URL)

	conn, err := nats.Connect(URL[0])
	if err != nil {
		return nil, err
	}

	return &hub{
		conn: conn,
		subs: make(map[*sub]struct{}),
	}, nil
}
func Open ( URL ... string ) ( pubsub . Hub , error ) { if len ( URL ) == 0 { URL = [ ] string { nats . DefaultURL } } log . Info ( " " , URL ) conn , err := nats . Connect ( URL [ 0 ] ) if err != nil { return nil , err } return & hub { conn : conn , subs : make ( map [ * sub ] struct { } ) , } , nil }
// Open creates pubsub hub connected to nats server.
Open creates pubsub hub connected to nats server .