Skip to content

Instantly share code, notes, and snippets.

@domino14
Created July 22, 2020 04:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domino14/7049bdf12b1b86aaa149a49a6947ed5b to your computer and use it in GitHub Desktop.
Save domino14/7049bdf12b1b86aaa149a49a6947ed5b to your computer and use it in GitHub Desktop.
Register a realm
resp, err := h.pubsub.natsconn.Request("ipc.request.registerRealm", data, ipcTimeout)
if err != nil {
log.Err(err).Msg("timeout registering realm")
return err
}
// The response contains the correct realm for the user.
rrResp := &pb.RegisterRealmResponse{}
err = proto.Unmarshal(resp.Data, rrResp)
if err != nil {
return err
}
realm = rrResp.Realm
if Realm(realm) != NullRealm {
// Only add to the realm that the API says to add to.
h.addToRealm(Realm(realm), c)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment