mirror of
https://github.com/ading2210/libcurl.js.git
synced 2025-05-17 08:00:01 -04:00
add nodejs support
This commit is contained in:
parent
3a2ab40e75
commit
87b887a4b7
13 changed files with 78 additions and 18 deletions
10
client/fragments/fix_node_support.js
Normal file
10
client/fragments/fix_node_support.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
/* REPLACE
|
||||
__dirname
|
||||
*/
|
||||
globalThis.__dirname
|
||||
|
||||
/* DELETE
|
||||
if ?\(ENVIRONMENT_IS_NODE\) ?{\s*peer\.socket\.on.+?else ?(?={\s*peer\.socket\.onopen)
|
||||
*/
|
||||
|
||||
|
|
@ -12,3 +12,8 @@ var parts = addr.split("/");
|
|||
url = Module.websocket.url;
|
||||
if (!url.endsWith("/")) url += "/";
|
||||
url += parts[0] + ":" + port;
|
||||
|
||||
/* DELETE
|
||||
var WebSocketConstructor.+?WebSocketConstructor ?= ?WebSocket;?\s*}
|
||||
*/
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@ ws ?= ?new WebSocketConstructor\(url, ?opts\)
|
|||
*/
|
||||
try {
|
||||
if (api.transport === "wisp") {
|
||||
ws = new WispWebSocket(url);
|
||||
ws = new WispWebSocket(url, WSImpl);
|
||||
}
|
||||
else if (api.transport === "wsproxy") {
|
||||
ws = new WebSocket(url);
|
||||
ws = new WSImpl(url);
|
||||
}
|
||||
else if (typeof api.transport === "string") {
|
||||
throw new TypeError("invalid transport type");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue