mirror of
https://github.com/MercuryWorkshop/bare-mux.git
synced 2025-05-16 15:40:01 -04:00
update readme
This commit is contained in:
parent
d9b3ffe51d
commit
228ddac643
1 changed files with 5 additions and 2 deletions
|
@ -42,13 +42,16 @@ Here is an example of using bare-mux:
|
||||||
/// As an end-user
|
/// As an end-user
|
||||||
import { BareMuxConnection } from "@mercuryworkshop/bare-mux";
|
import { BareMuxConnection } from "@mercuryworkshop/bare-mux";
|
||||||
const conn = new BareMuxConnection("/bare-mux/worker.js");
|
const conn = new BareMuxConnection("/bare-mux/worker.js");
|
||||||
|
|
||||||
// Set Bare-Client transport
|
// Set Bare-Client transport
|
||||||
|
// If your transport is an ES module and exports the class as the default export
|
||||||
|
await conn.setTransport("/bare-mux/transport-module.js", ["arg1", "ws://localhost:4000"]);
|
||||||
|
|
||||||
|
// Set Transport Manually
|
||||||
await conn.setManualTransport(`
|
await conn.setManualTransport(`
|
||||||
const exports = await import("/bare-mux/transport.js");
|
const exports = await import("/bare-mux/transport.js");
|
||||||
return new exports.BareClient("https://tomp.app");
|
return new exports.BareClient("https://tomp.app");
|
||||||
`);
|
`);
|
||||||
// If your transport is an ES module and exports the class as the default export
|
|
||||||
await conn.setTransport("/bare-mux/transport-module.js", ["arg1", "ws://localhost:4000"]);
|
|
||||||
|
|
||||||
/// As a proxy developer
|
/// As a proxy developer
|
||||||
import { BareClient } from "@mercuryworkshop/bare-mux";
|
import { BareClient } from "@mercuryworkshop/bare-mux";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue