Skip to content

Commit

Permalink
asynchronous non-blocking read and write support
Browse files Browse the repository at this point in the history
  • Loading branch information
lixizan committed Feb 25, 2023
1 parent 6351fe3 commit 73420c6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ build:
run-testsuite-server:
go run github.com/lxzan/gws/examples/testsuite

coverage:
go test ./... -covermode=count -coverprofile=./bin/gws.out
cover:
go test -coverprofile=./bin/cover.out --cover ./...
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

- [gws](#gws)
- [Highlight](#highlight)
- [Attention](#attention)
- [Benchmark](#benchmark)
- [Core Interface](#core-interface)
- [Install](#install)
Expand All @@ -42,14 +41,9 @@
- zero extra goroutine to manage connection
- zero error to read/write operation, errors have been handled appropriately
- built-in concurrent_map implementation
- support for asynchronous write messages
- asynchronous non-blocking read and write support
- fully passes the WebSocket [autobahn-testsuite](https://github.com/crossbario/autobahn-testsuite)

#### Attention

- It's designed for api server, not suitable for transmitting large messages.
- WebSocket events are emitted synchronously, manage goroutines yourself.

#### Benchmark

- machine: Ubuntu 20.04LTS VM (4C8T)
Expand Down
1 change: 0 additions & 1 deletion aio.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ type (
func newWorkerQueue(maxConcurrency int64) *workerQueue {
c := &workerQueue{
mu: &sync.Mutex{},
q: make([]asyncJob, 0),
maxConcurrency: maxConcurrency,
curConcurrency: 0,
}
Expand Down
2 changes: 1 addition & 1 deletion examples/testsuite/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (

func main() {
var upgrader = gws.NewUpgrader(func(c *gws.Upgrader) {
c.EventHandler = new(WebSocket)
c.CompressEnabled = true
c.CheckTextEncoding = true
c.MaxContentLength = 32 * 1024 * 1024
c.AsyncReadEnabled = true
c.EventHandler = new(WebSocket)
})

http.HandleFunc("/connect", func(writer http.ResponseWriter, request *http.Request) {
Expand Down

0 comments on commit 73420c6

Please sign in to comment.