sdk-go icon indicating copy to clipboard operation
sdk-go copied to clipboard

[Braindump] Proposal for redesigning the client interface

Open slinkydeveloper opened this issue 5 years ago • 3 comments

I came out with this proposal after working on #606.

My problem with the Client interface is that, while Send and Request maps the interfaces in protocol, StartReceiver doesn't map the semantics of Receiver and Responder. This is particularly weird with websocket for example, when you have a bi-directional client per stream, so you can do something like:

c.Send()
[...]
c.Receive()

In particular, I find that StartReceiver is opinionated, maps to the concepts of http more than the concepts of messaging and it's less golang idiomatic than a channel or a method like Receive. Another point to consider is that going from the method invocation to the handler mode is relatively straightforward (and we could easily provide the method to do it, like showed in this PR), while going from the handler mode to the method invocation is harder and, generally, more error prone.

Signed-off-by: Francesco Guardiani [email protected]

slinkydeveloper avatar Nov 09 '20 17:11 slinkydeveloper

Think about a v3?

n3wscott avatar Jan 07 '21 17:01 n3wscott

Maybe, let's get the 2.4 out first :smile:

slinkydeveloper avatar Jan 08 '21 08:01 slinkydeveloper

Would someone like to follow through on this one? If not we're probably going to close it.

duglin avatar Jun 01 '23 13:06 duglin