package protocol import ( "io" ) type MessageType int const ( MessageTypeUnknown MessageType = iota MessageTypeRequest MessageTypeResponse MessageTypeNotification ) // ClientCodec creates a ClientCodecRequest to process each request. type ClientCodec interface { WriteRequest(w io.Writer, method string, args interface{}, id interface{}) error NewMessage(rc io.Reader) (ClientMessageCodec, error) } type ClientRequestCodec interface { RegistryCodec } // ClientMessageCodec decodes a response or notification using a specific // serialization scheme. type ClientMessageCodec interface { MessageType() MessageType // Reads the message filling the RPC response or notification. MessageCodec() (interface{}, error) Close() } type ClientResponseCodec interface { Result(result interface{}) error Error() error ID() interface{} Close() } type ClientNotificationCodec interface { RegistryCodec }