mirror of
https://github.com/ading2210/libcurl.js.git
synced 2025-05-13 22:40:01 -04:00
log errors when creating connections and add npm export for bundled version
This commit is contained in:
parent
2c04f55a5e
commit
b374d02e48
4 changed files with 31 additions and 13 deletions
|
@ -1,14 +1,21 @@
|
|||
/* REPLACE
|
||||
new WebSocketConstructor
|
||||
ws ?= ?new WebSocketConstructor\(url, ?opts\)
|
||||
*/
|
||||
new ((() => {
|
||||
try {
|
||||
if (api.transport === "wisp") {
|
||||
return WispWebSocket;
|
||||
ws = new WispWebSocket(url);
|
||||
}
|
||||
else if (api.transport === "wsproxy") {
|
||||
return WebSocket;
|
||||
ws = new WebSocket(url);
|
||||
}
|
||||
else if (typeof api.transport === "string") {
|
||||
throw "invalid transport type";
|
||||
}
|
||||
else { //custom transports
|
||||
return api.transport;
|
||||
ws = new api.transport(url);
|
||||
}
|
||||
})())
|
||||
}
|
||||
catch (e) {
|
||||
error_msg("Error while creating a TCP connection: " + e);
|
||||
throw e;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue