Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revision 0.8.4 #25

Merged
merged 2 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sinclair/smoke",
"version": "0.8.3",
"version": "0.8.4",
"description": "Run Web Servers in Web Browsers over WebRTC",
"type": "module",
"main": "./index.mjs",
Expand All @@ -22,7 +22,7 @@
"author": "sinclair",
"license": "MIT",
"devDependencies": {
"@sinclair/drift": "^0.9.0",
"@sinclair/drift": "^0.9.1",
"@sinclair/hammer": "^0.18.0",
"prettier": "^3.2.5",
"typescript": "^5.4.3"
Expand Down
16 changes: 8 additions & 8 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ $ npm install @sinclair/smoke

## Overview

Smoke is an experimental networking and storage framework for the browser that provides Http, Tcp and WebSocket emulation over WebRTC and large file storage via IndexedDB. It is built as a foundation for developing peer to peer services in the browser with each browser accessible via an application controlled virtual network.
Smoke is an experimental browser networking and storage framework that provides Http, Tcp and WebSocket emulation over WebRTC and large file storage via IndexedDB. It is built as a foundation for developing peer to peer web services in the browser with each browser accessible via an application controlled virtual network.

Smoke reshapes WebRTC into WinterCG compatible interfaces enabling traditional web server applications to be made portable between server and browser environments. It is developed in support of alternative software architectures where user centric services can be moved away from the cloud and run peer to peer in the browser.

Expand Down Expand Up @@ -143,7 +143,7 @@ const { Http } = new Network()
<a name="Http-Listen"></a>
### Listen

Use the Http listen function to receive Http requests from remote peers.
Use the listen function to receive Http requests from remote peers.

```typescript
Http.listen({ port: 5000 }, request => new Response('hello'))
Expand All @@ -152,7 +152,7 @@ Http.listen({ port: 5000 }, request => new Response('hello'))
<a name="Http-Fetch"></a>
### Fetch

Use Http fetch function to make a Http request to remote peers.
Use the fetch function to make a Http request to remote peers.

```typescript
const response = await Http.fetch('http://localhost:5000')
Expand All @@ -163,7 +163,7 @@ const message = await response.text()
<a name="Http-Upgrade"></a>
### Upgrade

Use upgrade function to convert a Http request into a WebSocket
Use the upgrade function to convert a Http request into a WebSocket

```typescript
Http.listen({ port: 5000 }, request => Http.upgrade(request, (socket) => socket.send('hello')))
Expand All @@ -172,7 +172,7 @@ Http.listen({ port: 5000 }, request => Http.upgrade(request, (socket) => socket.
<a name="Http-Connect"></a>
### Connect

Use connect function to establish a connection remote WebSocket server.
Use the connect function to connect to a remote WebSocket server.

```typescript
const socket = await Http.connect('ws://localhost:5000')
Expand All @@ -196,7 +196,7 @@ const { Net } = new Network()
<a name="Net-Listen"></a>
### Listen

Use the Net listen function to accept incoming sockets.
Use the listen function to accept an incoming socket.

```typescript
Net.listen({ port: 5000 }, async socket => {
Expand Down Expand Up @@ -236,7 +236,7 @@ const { Media } = new Network()
<a name="Media-Listen"></a>
### Listen

Use the listen function to listen for incoming MediaStream
Use the listen function to listen for incoming MediaStream objects

```typescript
Media.listen({ port: 6000 }, (receiver) => {
Expand Down Expand Up @@ -333,7 +333,7 @@ const exists = await Fs.exists('/path/file.txt')
<a name="FileSystem-Mkdir"></a>
### Mkdir

Use the mkdir function to recursively create a directory.
Use the mkdir function to create a directory.

```typescript
await Fs.mkdir('/media/videos')
Expand Down
1 change: 1 addition & 0 deletions src/net/socket.mts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export class NetSocket implements Stream.Read<Uint8Array>, Stream.Write<Uint8Arr
this.#mutex = new Async.Mutex()
this.#readchannel = new Channel.Channel<Uint8Array>()
this.#datachannel = datachannel
this.#datachannel.binaryType = 'arraybuffer'
this.#datachannel.addEventListener('message', (event) => this.#onMessage(event))
this.#datachannel.addEventListener('close', (event) => this.#onClose(event))
this.#datachannel.addEventListener('error', (event) => this.#onError(event))
Expand Down
Loading