@mercuryworkshop/epoxy-tls
Advanced tools
Comparing version 1.1.1 to 1.2.0
26
demo.js
@@ -5,3 +5,12 @@ import epoxy from "./pkg/epoxy-module-bundled.js"; | ||
console.debug("recieved demo:", msg); | ||
let [should_feature_test, should_multiparallel_test, should_parallel_test, should_multiperf_test, should_perf_test, should_ws_test, should_tls_test] = msg.data; | ||
let [ | ||
should_feature_test, | ||
should_multiparallel_test, | ||
should_parallel_test, | ||
should_multiperf_test, | ||
should_perf_test, | ||
should_ws_test, | ||
should_tls_test, | ||
should_udp_test | ||
] = msg.data; | ||
console.log( | ||
@@ -172,7 +181,20 @@ "%cWASM is significantly slower with DevTools open!", | ||
err => console.error(err), | ||
msg => { console.log(msg); console.log(decoder.decode(msg)) }, | ||
msg => { console.log(msg); log(decoder.decode(msg)) }, | ||
"alicesworld.tech:443", | ||
); | ||
await ws.send("GET / HTTP 1.1\r\nHost: alicesworld.tech\r\nConnection: close\r\n\r\n"); | ||
await (new Promise((res, _) => setTimeout(res, 500))); | ||
await ws.close(); | ||
} else if (should_udp_test) { | ||
let decoder = new TextDecoder(); | ||
// nc -ulp 5000 | ||
let ws = await epoxy_client.connect_udp( | ||
() => log("opened"), | ||
() => log("closed"), | ||
err => console.error(err), | ||
msg => { console.log(msg); log(decoder.decode(msg)) }, | ||
"127.0.0.1:5000", | ||
); | ||
await (new Promise((res, _) => setTimeout(res, 5000))); | ||
await ws.close(); | ||
} else { | ||
@@ -179,0 +201,0 @@ let resp = await epoxy_client.fetch("https://httpbin.org/get"); |
{ | ||
"name": "@mercuryworkshop/epoxy-tls", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "A wasm library for using raw encrypted tls/ssl/https/websocket streams on the browser", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -46,3 +46,12 @@ declare namespace wasm_bindgen { | ||
/** | ||
* @param {Function} onopen | ||
* @param {Function} onclose | ||
* @param {Function} onerror | ||
* @param {Function} onmessage | ||
* @param {string} url | ||
* @returns {Promise<EpxUdpStream>} | ||
*/ | ||
connect_udp(onopen: Function, onclose: Function, onerror: Function, onmessage: Function, url: string): Promise<EpxUdpStream>; | ||
/** | ||
* @param {string} url | ||
* @param {object} options | ||
@@ -99,2 +108,40 @@ * @returns {Promise<Response>} | ||
*/ | ||
export class EpxUdpStream { | ||
/** | ||
** Return copy of self without private attributes. | ||
*/ | ||
toJSON(): Object; | ||
/** | ||
* Return stringified version of self. | ||
*/ | ||
toString(): string; | ||
free(): void; | ||
/** | ||
*/ | ||
constructor(); | ||
/** | ||
* @param {EpoxyClient} tcp | ||
* @param {Function} onopen | ||
* @param {Function} onclose | ||
* @param {Function} onerror | ||
* @param {Function} onmessage | ||
* @param {string} url | ||
* @returns {Promise<EpxUdpStream>} | ||
*/ | ||
static connect(tcp: EpoxyClient, onopen: Function, onclose: Function, onerror: Function, onmessage: Function, url: string): Promise<EpxUdpStream>; | ||
/** | ||
* @param {Uint8Array} payload | ||
* @returns {Promise<void>} | ||
*/ | ||
send(payload: Uint8Array): Promise<void>; | ||
/** | ||
* @returns {Promise<void>} | ||
*/ | ||
close(): Promise<void>; | ||
/** | ||
*/ | ||
readonly url: string; | ||
} | ||
/** | ||
*/ | ||
export class EpxWebSocket { | ||
@@ -101,0 +148,0 @@ /** |
@@ -46,3 +46,12 @@ declare namespace wasm_bindgen { | ||
/** | ||
* @param {Function} onopen | ||
* @param {Function} onclose | ||
* @param {Function} onerror | ||
* @param {Function} onmessage | ||
* @param {string} url | ||
* @returns {Promise<EpxUdpStream>} | ||
*/ | ||
connect_udp(onopen: Function, onclose: Function, onerror: Function, onmessage: Function, url: string): Promise<EpxUdpStream>; | ||
/** | ||
* @param {string} url | ||
* @param {object} options | ||
@@ -99,2 +108,40 @@ * @returns {Promise<Response>} | ||
*/ | ||
export class EpxUdpStream { | ||
/** | ||
** Return copy of self without private attributes. | ||
*/ | ||
toJSON(): Object; | ||
/** | ||
* Return stringified version of self. | ||
*/ | ||
toString(): string; | ||
free(): void; | ||
/** | ||
*/ | ||
constructor(); | ||
/** | ||
* @param {EpoxyClient} tcp | ||
* @param {Function} onopen | ||
* @param {Function} onclose | ||
* @param {Function} onerror | ||
* @param {Function} onmessage | ||
* @param {string} url | ||
* @returns {Promise<EpxUdpStream>} | ||
*/ | ||
static connect(tcp: EpoxyClient, onopen: Function, onclose: Function, onerror: Function, onmessage: Function, url: string): Promise<EpxUdpStream>; | ||
/** | ||
* @param {Uint8Array} payload | ||
* @returns {Promise<void>} | ||
*/ | ||
send(payload: Uint8Array): Promise<void>; | ||
/** | ||
* @returns {Promise<void>} | ||
*/ | ||
close(): Promise<void>; | ||
/** | ||
*/ | ||
readonly url: string; | ||
} | ||
/** | ||
*/ | ||
export class EpxWebSocket { | ||
@@ -101,0 +148,0 @@ /** |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
4697963
16308