Skip to content

Commit

Permalink
chore: rename to websocket_broadcastchannel
Browse files Browse the repository at this point in the history
  • Loading branch information
hugojosefson committed Jun 25, 2023
1 parent 92c1e23 commit f07bf11
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 20 deletions.
29 changes: 19 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ for Deno, that uses
[WebSocket](https://developer.mozilla.org/docs/Web/API/WebSocket)s to
communicate between processes on the same host.

[![deno.land/x/websocket-broadcastchannel](https://shield.deno.dev/x/websocket-broadcastchannel)](https://deno.land/x/websocket-broadcastchannel)
[![deno.land/x/websocket_broadcastchannel](https://shield.deno.dev/x/websocket_broadcastchannel)](https://deno.land/x/websocket_broadcastchannel)
[![CI](https://github.com/hugojosefson/deno-websocket-broadcastchannel/actions/workflows/ci.yaml/badge.svg)](https://github.com/hugojosefson/deno-websocket-broadcastchannel/actions/workflows/ci.yaml)

While
Expand All @@ -22,13 +22,21 @@ Requires a recent version of [Deno](https://deno.land/).

## API

Please see the
[auto-generated API documentation](https://deno.land/x/websocket-broadcastchannel?doc).
Please see MDN's documentation of the
[BroadcastChannel API](https://developer.mozilla.org/docs/Web/API/BroadcastChannel).

For specifics on what's `export`ed from this module, see our
[auto-generated API documentation](https://deno.land/x/websocket_broadcastchannel?doc).

## Example usage

An example chat application, where each client is a separate process, and the
server is a separate process:
An example chat application, that you can run in several terminals on the same
host, and see the messages broadcast between them.

This uses the
[createBroadcastChannel](https://deno.land/x/websocket_broadcastchannel?doc#createbroadcastchannel)
function to create the relevant `BroadcastChannel` object, and then uses the
`BroadcastChannel` API as usual.

```typescript
import {
Expand All @@ -37,7 +45,7 @@ import {
Logger,
logger,
WebSocketBroadcastChannel,
} from "https://deno.land/x/websocket-broadcastchannel/mod.ts";
} from "https://deno.land/x/websocket_broadcastchannel/mod.ts";
const log: Logger = logger(import.meta.url);

/**
Expand Down Expand Up @@ -70,8 +78,9 @@ the others will take over that duty, and the rest will reconnect to it.
Running on Deno Deploy. Application-wide BroadcastChannel is fully supported,
so you don't need WebSocketBroadcastChannel!
(It makes little sense to use stdin on Deno Deploy, so this example is only
useful on Deno Deploy, for seeing this detection in your logs :)
(However, it makes little sense to read from stdin on Deno Deploy, so this
example CLI-based chat app is only useful on Deno Deploy, for seeing this
detection in your logs :)
===============================================================================
`);
}
Expand Down Expand Up @@ -114,11 +123,11 @@ if (import.meta.main) {
To run the above example:

```sh
deno run --reload --allow-net https://deno.land/x/websocket-broadcastchannel/readme/chat.ts
deno run --reload --allow-net https://deno.land/x/websocket_broadcastchannel/readme/chat.ts
```

If you want to see all the debug output:

```sh
DEBUG='*' deno run --allow-env=DEBUG --reload --allow-net https://deno.land/x/websocket-broadcastchannel/readme/chat.ts
DEBUG='*' deno run --allow-env=DEBUG --reload --allow-net https://deno.land/x/websocket_broadcastchannel/readme/chat.ts
```
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"all-reload": "deno fmt && deno lint && deno task check --reload && deno task test --reload",
"check": "sh -c '$(command -v fd || command -v fdfind) '\"'\"'\\.(mj|j|t)sx?$'\"'\"' --hidden --exec deno check {}'",
"test": "deno test --allow-run --allow-env=VERBOSE",
"readme": "touch README.md && chmod +w README.md && ./readme/generate-readme.ts readme/README.md https://deno.land/x/websocket-broadcastchannel > README.md && deno fmt README.md && chmod -w README.md",
"readme": "touch README.md && chmod +w README.md && ./readme/generate-readme.ts readme/README.md https://deno.land/x/websocket_broadcastchannel > README.md && deno fmt README.md && chmod -w README.md",
"readme-html": "deno task readme && sh -c 'docker run --rm -i hugojosefson/markdown <README.md >README.html'",
"release": "deno task all && test -z \"$(git status --porcelain)\" && GITHUB_TOKEN=$(gh auth token) deno run --allow-env=GITHUB_TOKEN --allow-net=api.github.com --allow-run=bash https://deno.land/x/shipit@0.6.1/shipit.ts",
"udd": "sh -c 'deno run --allow-read=. --allow-write=. --allow-net --allow-run=deno https://deno.land/x/udd@0.8.2/main.ts --test \"deno task all\" $($(command -v fd || command -v fdfind) '\"'\"'(\\.(mj|j|t)sx?|^deno.jsonc?)$'\"'\"')'"
Expand Down
22 changes: 15 additions & 7 deletions readme/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ for Deno, that uses
[WebSocket](https://developer.mozilla.org/docs/Web/API/WebSocket)s to
communicate between processes on the same host.

[![deno.land/x/websocket-broadcastchannel](https://shield.deno.dev/x/websocket-broadcastchannel)](https://deno.land/x/websocket-broadcastchannel)
[![deno.land/x/websocket_broadcastchannel](https://shield.deno.dev/x/websocket_broadcastchannel)](https://deno.land/x/websocket_broadcastchannel)
[![CI](https://github.com/hugojosefson/deno-websocket-broadcastchannel/actions/workflows/ci.yaml/badge.svg)](https://github.com/hugojosefson/deno-websocket-broadcastchannel/actions/workflows/ci.yaml)

While
Expand All @@ -22,13 +22,21 @@ Requires a recent version of [Deno](https://deno.land/).

## API

Please see the
[auto-generated API documentation](https://deno.land/x/websocket-broadcastchannel?doc).
Please see MDN's documentation of the
[BroadcastChannel API](https://developer.mozilla.org/docs/Web/API/BroadcastChannel).

For specifics on what's `export`ed from this module, see our
[auto-generated API documentation](https://deno.land/x/websocket_broadcastchannel?doc).

## Example usage

An example chat application, where each client is a separate process, and the
server is a separate process:
An example chat application, that you can run in several terminals on the same
host, and see the messages broadcast between them.

This uses the
[createBroadcastChannel](https://deno.land/x/websocket_broadcastchannel?doc#createbroadcastchannel)
function to create the relevant `BroadcastChannel` object, and then uses the
`BroadcastChannel` API as usual.

```typescript
"@@include(./chat.ts)";
Expand All @@ -37,11 +45,11 @@ server is a separate process:
To run the above example:

```sh
deno run --reload --allow-net https://deno.land/x/websocket-broadcastchannel/readme/chat.ts
deno run --reload --allow-net https://deno.land/x/websocket_broadcastchannel/readme/chat.ts
```

If you want to see all the debug output:

```sh
DEBUG='*' deno run --allow-env=DEBUG --reload --allow-net https://deno.land/x/websocket-broadcastchannel/readme/chat.ts
DEBUG='*' deno run --allow-env=DEBUG --reload --allow-net https://deno.land/x/websocket_broadcastchannel/readme/chat.ts
```
5 changes: 3 additions & 2 deletions readme/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ the others will take over that duty, and the rest will reconnect to it.
Running on Deno Deploy. Application-wide BroadcastChannel is fully supported,
so you don't need WebSocketBroadcastChannel!
(It makes little sense to use stdin on Deno Deploy, so this example is only
useful on Deno Deploy, for seeing this detection in your logs :)
(However, it makes little sense to read from stdin on Deno Deploy, so this
example CLI-based chat app is only useful on Deno Deploy, for seeing this
detection in your logs :)
===============================================================================
`);
}
Expand Down

0 comments on commit f07bf11

Please sign in to comment.