larasopp 1.2.7 → 1.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/Core.js CHANGED
@@ -55,10 +55,8 @@ class Core {
55
55
  */
56
56
  connect(token) {
57
57
  try {
58
- const host = [this.config.host];
59
- if (this.config.token)
60
- host.push('/token=' + (token !== null && token !== void 0 ? token : this.config.token));
61
- this.ws = new WebSocket(host.join(''));
58
+ const host = this.config.host + '/token=' + (token !== null && token !== void 0 ? token : this.config.token);
59
+ this.ws = new WebSocket(encodeURI(host));
62
60
  this.ws.onopen = this.handleOpen;
63
61
  this.ws.onclose = this.handleClose;
64
62
  this.ws.onerror = this.handleError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "larasopp",
3
- "version": "1.2.7",
3
+ "version": "1.2.8",
4
4
  "description": "Websocket client for laravel",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
package/src/Core.ts CHANGED
@@ -79,10 +79,8 @@ abstract class Core {
79
79
  */
80
80
  public connect(token?: string): this {
81
81
  try {
82
- const host = [this.config.host];
83
- if (this.config.token) host.push('/token=' + (token ?? this.config.token));
84
-
85
- this.ws = new WebSocket(host.join(''));
82
+ const host = this.config.host + '/token=' + (token ?? this.config.token);
83
+ this.ws = new WebSocket(encodeURI(host));
86
84
  this.ws.onopen = this.handleOpen;
87
85
  this.ws.onclose = this.handleClose;
88
86
  this.ws.onerror = this.handleError;