diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ae5be013..821d7241 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,7 +43,7 @@ to manage dependencies. The version of Go should be **1.17** or above. ```sh $ git clone https://github.com/$GITHUB_USER/ronykit $ cd ronykit -$ git remote add upstream git@github.com:clubpay/kit.git +$ git remote add upstream git@github.com:clubpay/ronykit.git # Never push to the upstream master git remote set-url --push upstream no_push diff --git a/kit/stub/stub_rest.go b/kit/stub/stub_rest.go index f036b38f..66d20671 100644 --- a/kit/stub/stub_rest.go +++ b/kit/stub/stub_rest.go @@ -163,7 +163,7 @@ func (hc *RESTCtx) Error() error { // StatusCode returns the status code of the response func (hc *RESTCtx) StatusCode() int { return hc.res.StatusCode() } -// GetHeader returns the header value for key in the response +// GetHeader returns the header value for the key in the response func (hc *RESTCtx) GetHeader(key string) string { return string(hc.res.Header.Peek(key)) } @@ -190,7 +190,7 @@ func (hc *RESTCtx) CopyBody(dst []byte) []byte { return dst } -// Release frees the allocates internal resources to be re-used. +// Release frees the allocated internal resources to be re-used. // You MUST NOT refer to any method of this object after calling this method, if // you call any method after Release has been called, the result is unpredictable. func (hc *RESTCtx) Release() { diff --git a/kit/stub/stub_ws.go b/kit/stub/stub_ws.go index bdabf071..53049c27 100644 --- a/kit/stub/stub_ws.go +++ b/kit/stub/stub_ws.go @@ -250,12 +250,19 @@ func (wCtx *WebsocketCtx) NetConn() net.Conn { } type WebsocketRequest struct { - Predicate string + // Predicate is the routing key for the message, which will be added to the kit.OutgoingRPCContainer + Predicate string + // MessageType is the type of the message, either websocket.TextMessage or websocket.BinaryMessage MessageType int ReqMsg kit.Message - ResMsg kit.Message - ReqHdr Header - Callback RPCMessageHandler + // ResMsg is the message that will be used to unmarshal the response. + // You should pass a pointer to the struct that you want to unmarshal the response into. + ResMsg kit.Message + // ReqHdr is the headers that will be added to the kit.OutgoingRPCContainer + ReqHdr Header + // Callback is the callback that will be called when the response is received. + // This MUST BE non-nil otherwise it panics. + Callback RPCMessageHandler } func (wCtx *WebsocketCtx) Do(ctx context.Context, req WebsocketRequest) error {