encode connection to pubsub #4

Merged
luuvansinh merged 1 commits from pubsub-with-json-encode into master 2022-08-10 10:52:20 +00:00
1 changed files with 5 additions and 0 deletions

View File

@ -34,3 +34,8 @@ func (sv Server) Subscribe(subject string, cb nats.MsgHandler) (*nats.Subscripti
}
return sub, nil
}
// NewJSONEncodedConn ...
func (sv Server) NewJSONEncodedConn() (*nats.EncodedConn, error) {
return nats.NewEncodedConn(sv.instance, nats.JSON_ENCODER)
}