2018-04-03 08:58:26 +00:00
|
|
|
package protocol
|
|
|
|
|
|
|
|
// ServerCodec creates a ServerRequestCodec to process each request.
|
|
|
|
type ServerCodec interface {
|
2018-06-30 16:37:26 +00:00
|
|
|
NewRequest(messageType int, message []byte) (ServerRequestCodec, error)
|
|
|
|
// NewRequestWithString(method string, params []string, id interface{}) (ServerRequestCodec, error)
|
|
|
|
NewNotification(method string, args []interface{}) (messageType int, message []byte, err error)
|
2018-04-03 08:58:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ServerRequestCodec decodes a request and encodes a response using a specific
|
|
|
|
// serialization scheme.
|
|
|
|
type ServerRequestCodec interface {
|
|
|
|
RegistryCodec
|
|
|
|
|
2018-04-05 04:54:34 +00:00
|
|
|
HasResponse() bool
|
2018-06-30 16:37:26 +00:00
|
|
|
NewResponse(reply interface{}, replyErr error) (messageType int, message []byte, err error)
|
|
|
|
NewResponseWithString(reply string, replyErr error) (messageType int, message []byte, err error)
|
2018-04-03 08:58:26 +00:00
|
|
|
}
|