diff --git a/v1/client.go b/v1/client.go index fc66d00..8a6f31d 100644 --- a/v1/client.go +++ b/v1/client.go @@ -925,7 +925,7 @@ func (c WsOption) apply(opts *wsParams) { } // WsMeta let you receive url & headers to open web socket connection -func (c *MgClient) WsMeta(events []string, opts ...WsParams) (string, http.Header, error) { +func (c *MgClient) WsMeta(events []string, urlParams ...WsParams) (string, http.Header, error) { var url string if len(events) < 1 { @@ -935,12 +935,12 @@ func (c *MgClient) WsMeta(events []string, opts ...WsParams) (string, http.Heade url = fmt.Sprintf("%s%s%s%s", strings.Replace(c.URL, "https", "wss", 1), prefix, "/ws?events=", strings.Join(events[:], ",")) - var wsOpts wsParams - for _, opt := range opts { - opt.apply(&wsOpts) + var params wsParams + for _, opt := range urlParams { + opt.apply(¶ms) } - if len(wsOpts.options) > 0 { - url = fmt.Sprintf("%s&options=%s", url, strings.Join(wsOpts.options, ",")) + if len(params.options) > 0 { + url = fmt.Sprintf("%s&options=%s", url, strings.Join(params.options, ",")) } if url == "" { diff --git a/v1/client_test.go b/v1/client_test.go index d3ba722..039f060 100644 --- a/v1/client_test.go +++ b/v1/client_test.go @@ -849,9 +849,9 @@ func TestMgClient_CommandEditDelete(t *testing.T) { func TestMgClient_WsMeta_With_Options(t *testing.T) { c := client() events := []string{"user_updated", "user_join_chat"} - options := []WsParams{WsOptionIncludeMassCommunication} + params := []WsParams{WsOptionIncludeMassCommunication} - url, headers, err := c.WsMeta(events, options...) + url, headers, err := c.WsMeta(events, params...) if err != nil { t.Errorf("%v", err)