Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidPeerId = errors.New("invalid peer id") ErrInvalidCallId = errors.New("invalid call id") ErrInvalidMethod = errors.New("invalid method") )
View Source
var ( RequestUnmarshalErrorResponse = &CallResponse{ CallId: "", Method: "", Status: codes.InvalidArgument, Data: nil, } PeerOfflineResponseError = errors.New("peer offline") CallTimeoutResponseError = errors.New("call timeout") )
Functions ¶
This section is empty.
Types ¶
type CallRequest ¶
type CallRequest struct { //对端id PeerId string `json:"peerId"` //请求id CallId string `json:"callId"` //请求方法 Method string `json:"method"` //请求携带的数据 Data []byte `json:"data"` }
func (*CallRequest) FromBytes ¶
func (r *CallRequest) FromBytes(data []byte) error
func (*CallRequest) ToBytes ¶
func (r *CallRequest) ToBytes() []byte
func (*CallRequest) Validate ¶
func (r *CallRequest) Validate() error
type CallResponse ¶
type CallResponse struct { //请求id CallId string `json:"callId"` //请求方法 Method string `json:"method"` //响应状态 Status codes.Code `json:"status"` //响应携带的数据 Data []byte `json:"data"` }
func CallTimeoutResponse ¶
func CallTimeoutResponse(callId string, method string) *CallResponse
func PeerOfflineResponse ¶
func PeerOfflineResponse(callId string, method string) *CallResponse
func (*CallResponse) FromBytes ¶
func (r *CallResponse) FromBytes(msg []byte) error
func (*CallResponse) ToBytes ¶
func (r *CallResponse) ToBytes() []byte
Click to show internal directories.
Click to hide internal directories.