mirror of
https://github.com/ading2210/libcurl.js.git
synced 2025-05-11 13:30:01 -04:00
21 lines
468 B
JavaScript
21 lines
468 B
JavaScript
/* REPLACE
|
|
ws ?= ?new WebSocketConstructor\(url, ?opts\)
|
|
*/
|
|
try {
|
|
if (api.transport === "wisp") {
|
|
ws = new WispWebSocket(url);
|
|
}
|
|
else if (api.transport === "wsproxy") {
|
|
ws = new WebSocket(url);
|
|
}
|
|
else if (typeof api.transport === "string") {
|
|
throw new TypeError("invalid transport type");
|
|
}
|
|
else { //custom transports
|
|
ws = new api.transport(url);
|
|
}
|
|
}
|
|
catch (e) {
|
|
error_msg("Error while creating a TCP connection: " + e);
|
|
throw e;
|
|
}
|