We need a standard way to add wrp messages to a context.Context. This standard should support not only wrp.Message but also all the other message types, such as wrp.SimpleRequestResponse.
The basic API, from a client's point of view, can look like the de facto standard way of doing this for golang:
// putting a message into a context
var msg *wrp.Message
ctx := wrpcontext.Set(ctx, msg)
// getting a wrp.Message from a context
var msg *wrp.Message = wrpcontext.Get(ctx) // nil means no message
// getting a message from a context using semantics from the errors package,
// which supports
var msg *wrp.Message
if !wrpcontext.GetAs(ctx, &msg) {
// no message, or the message was not of type *wrp.Message
}
We need a standard way to add
wrp
messages to acontext.Context
. This standard should support not onlywrp.Message
but also all the other message types, such aswrp.SimpleRequestResponse
.The basic API, from a client's point of view, can look like the de facto standard way of doing this for
golang
: