iso-websocket
Advanced tools
Comparing version 0.1.6 to 0.2.0
@@ -31,3 +31,3 @@ /** | ||
*/ | ||
set binaryType(arg: BinaryType); | ||
set binaryType(type: BinaryType); | ||
get binaryType(): BinaryType; | ||
@@ -34,0 +34,0 @@ /** |
{ | ||
"name": "iso-websocket", | ||
"type": "module", | ||
"version": "0.1.6", | ||
"version": "0.2.0", | ||
"description": "Isomorphic, resilient and extensible Websocket.", | ||
@@ -38,16 +38,16 @@ "author": "Hugo Dias <hugomrdias@gmail.com> (hugodias.me)", | ||
"retry": "^0.13.1", | ||
"typescript-event-target": "^1.1.0" | ||
"typescript-event-target": "^1.1.0", | ||
"unws": "^0.2.4", | ||
"ws": "^8.16.0" | ||
}, | ||
"devDependencies": { | ||
"@types/debug": "^4.1.10", | ||
"@types/node": "^20.8.10", | ||
"@types/retry": "^0.12.4", | ||
"@types/ws": "^8.5.8", | ||
"@types/debug": "^4.1.12", | ||
"@types/node": "^20.11.15", | ||
"@types/retry": "^0.12.5", | ||
"@types/ws": "^8.5.10", | ||
"delay": "^6.0.0", | ||
"p-defer": "^4.0.0", | ||
"playwright-test": "^12.4.3", | ||
"type-fest": "^4.6.0", | ||
"typescript": "5.2.2", | ||
"unws": "^0.2.4", | ||
"ws": "^8.14.2" | ||
"playwright-test": "^14.1.0", | ||
"type-fest": "^4.10.2", | ||
"typescript": "5.3.3" | ||
}, | ||
@@ -54,0 +54,0 @@ "publishConfig": { |
import { TypedEventTarget } from 'typescript-event-target' | ||
import debug from 'debug' | ||
import { WebSocket } from 'unws' | ||
import * as retry from 'retry' | ||
@@ -57,3 +58,3 @@ import { | ||
if (!options.ws && typeof WebSocket === 'undefined') { | ||
if (!options.ws && WebSocket === undefined) { | ||
throw new TypeError('No WebSocket implementation found.') | ||
@@ -204,3 +205,12 @@ } | ||
#getUrl() { | ||
return typeof this.#url === 'function' ? this.#url() : this.#url | ||
const url = new URL( | ||
typeof this.#url === 'function' ? this.#url() : this.#url | ||
) | ||
if (url.protocol === 'http:') { | ||
url.protocol = 'ws:' | ||
} | ||
if (url.protocol === 'https:') { | ||
url.protocol = 'wss:' | ||
} | ||
return url.toString() | ||
} | ||
@@ -207,0 +217,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29614
9
796
5
+ Addedunws@^0.2.4
+ Addedws@^8.16.0
+ Addedunws@0.2.4(transitive)
+ Addedws@8.18.0(transitive)