// UnregisterNatsSubject is used to unregister a client from a specific nats subject
// previously registered using 'RegisterMqttTopic'.
UnregisterNatsSubject is used to unregister a client from a specific nats subject
previously registered using 'RegisterMqttTopic'.
// UnregisterNatsSubject is used to unregister a client from a specific nats subject // previously registered using ' RegisterMqttTopic ' .
func (c *Client) UnregisterNatsSubject(subject string) error {
	msg := make(map[string]interface{})
	msg["subject"] = subject
	unregisterSubRequestCodec, err := goavro.NewCodec(schema.UnregisterSubRequest)
	if err != nil {
		return err
	}
	bytes, err := avro.Writer(msg, unregisterSubRequestCodec)
	if err != nil {
		return err
	}
	response, err := c.nats.Request(fmt.Sprintf("%s.config.unregister", c.target), bytes, 2*time.Second)
	if err != nil {
		if c.nats.LastError() != nil {
			return fmt.Errorf("%v for request", c.nats.LastError())
		}
		return err
	}
	avro, _ := avro.NewReader(response.Data)
	j, _ := avro.ByteString()
	res := schema.UnregisterSubResponseType{}
	err = json.Unmarshal(j, &res)
	if err != nil {
		return err
	}
	if res.Error != "" {
		return fmt.Errorf("%s", res.Error)
	}
	return nil
}
func ( c * Client ) UnregisterNatsSubject ( subject string ) error { msg := make ( map [ string ] interface { } ) msg [ " " ] = subject unregisterSubRequestCodec , err := goavro . NewCodec ( schema . UnregisterSubRequest ) if err != nil { return err } bytes , err := avro . Writer ( msg , unregisterSubRequestCodec ) if err != nil { return err } response , err := c . nats . Request ( fmt . Sprintf ( " " , c . target ) , bytes , 2 * time . Second ) if err != nil { if c . nats . LastError ( ) != nil { return fmt . Errorf ( " " , c . nats . LastError ( ) ) } return err } avro , _ := avro . NewReader ( response . Data ) j , _ := avro . ByteString ( ) res := schema . UnregisterSubResponseType { } err = json . Unmarshal ( j , & res ) if err != nil { return err } if res . Error != " " { return fmt . Errorf ( " " , res . Error ) } return nil }
UnregisterNatsSubject is used to unregister a client from a specific nats subject
previously registered using 'RegisterMqttTopic'.
UnregisterNatsSubject is used to unregister a client from a specific nats subject previously registered using ' RegisterMqttTopic ' .