mirror of
https://github.com/MercuryWorkshop/bare-mux.git
synced 2025-05-14 14:50:03 -04:00
Update README.md
This commit is contained in:
parent
5e3abbdbbe
commit
c6e247cc95
1 changed files with 14 additions and 7 deletions
21
README.md
21
README.md
|
@ -1,6 +1,7 @@
|
|||
# Bare-Mux
|
||||
# bare-mux
|
||||
<a href="https://www.npmjs.com/package/@mercuryworkshop/bare-mux"><img src="https://img.shields.io/npm/v/@mercuryworkshop/bare-mux.svg?maxAge=3600" alt="npm version" /></a>
|
||||
|
||||
A system for managing http transports in a project such as [Ultraviolet](https://github.com/Titaniumnetwork-dev/Ultraviolet).
|
||||
A system for managing http transports in a project such as [Ultraviolet](https://github.com/Titaniumnetwork-dev/Ultraviolet) and [Scramjet](https://github.com/MercuryWorkshop/Scramjet).
|
||||
|
||||
Written to make the job of creating new standards for transporting http data seamless.
|
||||
|
||||
|
@ -35,11 +36,14 @@ export interface BareTransport {
|
|||
meta: () => BareMeta
|
||||
}
|
||||
```
|
||||
|
||||
A guide to making a transport can be found [here](./documentation/Transport.md).
|
||||
|
||||
## Upgrading
|
||||
|
||||
A guide for updating from v1 to v2 can be found [here](https://github.com/MercuryWorkshop/bare-mux/blob/master/documentation/Upgrading.md).
|
||||
A guide for updating from v1 to v2 can be found [here](./documentation/Upgrading.md).
|
||||
|
||||
## Older bare-mux versions
|
||||
### Older bare-mux versions
|
||||
|
||||
Starting from v2, bare-mux uses [SharedWorkers](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker) to provide stability and improve on resource usage.
|
||||
|
||||
|
@ -51,18 +55,21 @@ If you're too lazy to do either of the above, you can install an outdated and un
|
|||
npm install @mercuryworkshop/bare-mux@1
|
||||
```
|
||||
|
||||
Examples of transports include [EpoxyTransport](https://github.com/MercuryWorkshop/EpoxyTransport), [CurlTransport](https://github.com/MercuryWorkshop/CurlTransport), and [Bare-Client](https://github.com/MercuryWorkshop/Bare-as-module3).
|
||||
## Usage
|
||||
Examples of transports include [EpoxyTransport](https://github.com/MercuryWorkshop/EpoxyTransport), [CurlTransport](https://github.com/MercuryWorkshop/CurlTransport), and [Bare-Client](https://github.com/MercuryWorkshop/Bare-as-module3).
|
||||
|
||||
Here is an example of using bare-mux:
|
||||
```js
|
||||
/// As an end-user
|
||||
import { BareMuxConnection } from "@mercuryworkshop/bare-mux";
|
||||
const conn = new BareMuxConnection("/bare-mux/worker.js");
|
||||
|
||||
// Set Bare-Client transport
|
||||
// If your transport is an ES module and exports the class as the default export
|
||||
await conn.setTransport("/path/to/transport/index.mjs", ["arg1", { wisp: "wss://wisp.mercurywork.shop" }, "arg3"]);
|
||||
// Epoxy Client as an example
|
||||
await conn.setTransport("/epoxy/index.mjs", [{ wisp: "wss://wisp.mercurywork.shop/" }]);
|
||||
```
|
||||
|
||||
```js
|
||||
/// As a proxy developer
|
||||
import { BareClient } from "@mercuryworkshop/bare-mux";
|
||||
const client = new BareClient();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue