Skip to content

Commit 7b4bd30

Browse files
authoredSep 22, 2019
Merge pull request #142 from nhooyr/wasm
Implement core API for WASM
·
v1.8.13v1.6.0
2 parents e09e295 + 76a6a26 commit 7b4bd30

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+875
-236
lines changed
 

‎.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ on: [push]
44
jobs:
55
fmt:
66
runs-on: ubuntu-latest
7-
container: docker://nhooyr/websocket-ci@sha256:6f6a00284eff008ad2cece8f3d0b4a2a3a8f2fcf7a54c691c64a92403abc4c75
7+
container: docker://nhooyr/websocket-ci@sha256:b6331f8f64803c8b1bbd2a0ee9e2547317e0de2348bccd9c8dbcc1d88ff5747f
88
steps:
99
- uses: actions/checkout@v1
1010
with:
1111
fetch-depth: 1
1212
- run: ./ci/fmt.sh
1313
lint:
1414
runs-on: ubuntu-latest
15-
container: docker://nhooyr/websocket-ci@sha256:6f6a00284eff008ad2cece8f3d0b4a2a3a8f2fcf7a54c691c64a92403abc4c75
15+
container: docker://nhooyr/websocket-ci@sha256:b6331f8f64803c8b1bbd2a0ee9e2547317e0de2348bccd9c8dbcc1d88ff5747f
1616
steps:
1717
- uses: actions/checkout@v1
1818
with:
1919
fetch-depth: 1
2020
- run: ./ci/lint.sh
2121
test:
2222
runs-on: ubuntu-latest
23-
container: docker://nhooyr/websocket-ci@sha256:6f6a00284eff008ad2cece8f3d0b4a2a3a8f2fcf7a54c691c64a92403abc4c75
23+
container: docker://nhooyr/websocket-ci@sha256:b6331f8f64803c8b1bbd2a0ee9e2547317e0de2348bccd9c8dbcc1d88ff5747f
2424
steps:
2525
- uses: actions/checkout@v1
2626
with:
@@ -30,7 +30,7 @@ jobs:
3030
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
3131
wasm:
3232
runs-on: ubuntu-latest
33-
container: docker://nhooyr/websocket-ci@sha256:6f6a00284eff008ad2cece8f3d0b4a2a3a8f2fcf7a54c691c64a92403abc4c75
33+
container: docker://nhooyr/websocket-ci@sha256:b6331f8f64803c8b1bbd2a0ee9e2547317e0de2348bccd9c8dbcc1d88ff5747f
3434
steps:
3535
- uses: actions/checkout@v1
3636
with:

‎README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ go get nhooyr.io/websocket
1616
## Features
1717

1818
- Minimal and idiomatic API
19-
- Tiny codebase at 1700 lines
19+
- Tiny codebase at 2200 lines
2020
- First class [context.Context](https://blog.golang.org/context) support
2121
- Thorough tests, fully passes the [autobahn-testsuite](https://github.com/crossbario/autobahn-testsuite)
2222
- [Zero dependencies](https://godoc.org/nhooyr.io/websocket?imports)
2323
- JSON and ProtoBuf helpers in the [wsjson](https://godoc.org/nhooyr.io/websocket/wsjson) and [wspb](https://godoc.org/nhooyr.io/websocket/wspb) subpackages
2424
- Highly optimized by default
2525
- Concurrent writes out of the box
26+
- [Complete WASM](https://godoc.org/nhooyr.io/websocket#hdr-WASM) support
2627

2728
## Roadmap
2829

2930
- [ ] WebSockets over HTTP/2 [#4](https://github.com/nhooyr/websocket/issues/4)
30-
- [ ] WASM Compilation [#121](https://github.com/nhooyr/websocket/issues/121)
3131

3232
## Examples
3333

@@ -115,7 +115,7 @@ Just compare the godoc of
115115

116116
The API for nhooyr/websocket has been designed such that there is only one way to do things
117117
which makes it easy to use correctly. Not only is the API simpler, the implementation is
118-
only 1700 lines whereas gorilla/websocket is at 3500 lines. That's more code to maintain,
118+
only 2200 lines whereas gorilla/websocket is at 3500 lines. That's more code to maintain,
119119
more code to test, more code to document and more surface area for bugs.
120120

121121
Moreover, nhooyr/websocket has support for newer Go idioms such as context.Context and
@@ -131,6 +131,8 @@ which results in awkward control flow. With nhooyr/websocket you use the Ping me
131131
that sends a ping and also waits for the pong, though you must be reading from the connection
132132
for the pong to be read.
133133

134+
Additionally, nhooyr.io/websocket can compile to [WASM](https://godoc.org/nhooyr.io/websocket#hdr-WASM) for the browser.
135+
134136
In terms of performance, the differences mostly depend on your application code. nhooyr/websocket
135137
reuses message buffers out of the box if you use the wsjson and wspb subpackages.
136138
As mentioned above, nhooyr/websocket also supports concurrent writers.

0 commit comments

Comments
 (0)
Please sign in to comment.