Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lxzan committed Jan 19, 2024
1 parent 4fefef8 commit 826777e
Show file tree
Hide file tree
Showing 33 changed files with 352 additions and 707 deletions.
40 changes: 0 additions & 40 deletions .github/workflows/autobahn.yml

This file was deleted.

20 changes: 10 additions & 10 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Go Test

on:
push:
branches: [ "master" ]
branches: [ "master", "testing" ]
pull_request:
branches: [ "master" ]

Expand All @@ -14,13 +14,13 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Test
run: go test -v ./...
- name: Bench
run: make bench
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Test
run: go test -v ./...
- name: Bench
run: make bench
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# Dependency directories (remove the comment below to include it)
.idea/
.vscode/
.run/
vendor/
cmd/
bin/
Expand Down
1 change: 1 addition & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ linters:
- gochecknoinits
- goconst
- depguard
- nestif
# Enable presets.
# https://golangci-lint.run/usage/linters
# Run only fast linters from enabled linters set (first run won't be fast)
Expand Down
30 changes: 19 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ PASS
- [Introduction](#introduction)
- [Why GWS](#why-gws)
- [Benchmark](#benchmark)
- [IOPS (Echo Server)](#iops-echo-server)
- [GoBench](#gobench)
- [IOPS (Echo Server)](#iops-echo-server)
- [GoBench](#gobench)
- [Index](#index)
- [Feature](#feature)
- [Attention](#attention)
Expand All @@ -79,11 +79,11 @@ PASS
- [Quick Start](#quick-start)
- [Best Practice](#best-practice)
- [More Examples](#more-examples)
- [KCP](#kcp)
- [Proxy](#proxy)
- [Broadcast](#broadcast)
- [WriteWithTimeout](#writewithtimeout)
- [Pub / Sub](#pub--sub)
- [KCP](#kcp)
- [Proxy](#proxy)
- [Broadcast](#broadcast)
- [WriteWithTimeout](#writewithtimeout)
- [Pub / Sub](#pub--sub)
- [Autobahn Test](#autobahn-test)
- [Communication](#communication)
- [Acknowledgments](#acknowledgments)
Expand All @@ -93,9 +93,10 @@ PASS
- [x] Event API
- [x] Broadcast
- [x] Dial via Proxy
- [x] Context-Takeover
- [x] Zero Allocs Read / Write
- [x] Passed `Autobahn` Test Cases [Server](https://lxzan.github.io/gws/reports/servers/) / [Client](https://lxzan.github.io/gws/reports/clients/)
- [x] Concurrent & Asynchronous Non-Blocking Write
- [x] Passed WebSocket [Autobahn-Testsuite](https://lxzan.github.io/gws/reports/servers/)

### Attention

Expand Down Expand Up @@ -151,9 +152,9 @@ const (

func main() {
upgrader := gws.NewUpgrader(&Handler{}, &gws.ServerOption{
ReadAsyncEnabled: true, // Parallel message processing
CompressEnabled: true, // Enable compression
Recovery: gws.Recovery, // Exception recovery
ReadAsyncEnabled: true, // Parallel message processing
Recovery: gws.Recovery, // Exception recovery
PermessageDeflate: gws.PermessageDeflate{Enabled: true}, // Enable compression
})
http.HandleFunc("/connect", func(writer http.ResponseWriter, request *http.Request) {
socket, err := upgrader.Upgrade(writer, request)
Expand Down Expand Up @@ -186,6 +187,7 @@ func (c *Handler) OnMessage(socket *gws.Conn, message *gws.Message) {
defer message.Close()
socket.WriteMessage(message.Opcode, message.Bytes())
}

```

### More Examples
Expand Down Expand Up @@ -262,13 +264,19 @@ func main() {
NewDialer: func() (gws.Dialer, error) {
return proxy.SOCKS5("tcp", "127.0.0.1:1080", nil, nil)
},
PermessageDeflate: gws.PermessageDeflate{
Enabled: true,
ServerContextTakeover: true,
ClientContextTakeover: true,
},
})
if err != nil {
log.Println(err.Error())
return
}
socket.ReadLoop()
}

```

#### Broadcast
Expand Down
32 changes: 20 additions & 12 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ PASS
- [介绍](#介绍)
- [为什么选择 GWS](#为什么选择-gws)
- [基准测试](#基准测试)
- [IOPS (Echo Server)](#iops-echo-server)
- [GoBench](#gobench)
- [IOPS (Echo Server)](#iops-echo-server)
- [GoBench](#gobench)
- [Index](#index)
- [特性](#特性)
- [注意](#注意)
Expand All @@ -71,11 +71,11 @@ PASS
- [快速上手](#快速上手)
- [最佳实践](#最佳实践)
- [更多用例](#更多用例)
- [KCP](#kcp)
- [代理](#代理)
- [广播](#广播)
- [写入超时](#写入超时)
- [发布/订阅](#发布订阅)
- [KCP](#kcp)
- [代理](#代理)
- [广播](#广播)
- [写入超时](#写入超时)
- [发布/订阅](#发布订阅)
- [Autobahn 测试](#autobahn-测试)
- [交流](#交流)
- [致谢](#致谢)
Expand All @@ -85,9 +85,10 @@ PASS
- [x] 事件驱动式 API
- [x] 广播
- [x] 代理拨号
- [x] 上下文接管
- [x] 读写过程零动态内存分配
- [x] 支持并发和异步非阻塞写入
- [x] 通过 [Autobahn-Testsuite](https://lxzan.github.io/gws/reports/servers/) 所有测试用例
- [x] 通过所有 `Autobahn` 测试用例 [Server](https://lxzan.github.io/gws/reports/servers/) / [Client](https://lxzan.github.io/gws/reports/clients/)

### 注意

Expand Down Expand Up @@ -131,9 +132,10 @@ func main() {
package main

import (
"github.com/lxzan/gws"
"net/http"
"time"

"github.com/lxzan/gws"
)

const (
Expand All @@ -143,9 +145,9 @@ const (

func main() {
upgrader := gws.NewUpgrader(&Handler{}, &gws.ServerOption{
ReadAsyncEnabled: true, // 开启并行消息处理
CompressEnabled: true, // 开启压缩
Recovery: gws.Recovery, // 开启异常恢复
ReadAsyncEnabled: true, // 开启并行消息处理
Recovery: gws.Recovery, // 开启异常恢复
PermessageDeflate: gws.PermessageDeflate{Enabled: true}, // 开启压缩
})
http.HandleFunc("/connect", func(writer http.ResponseWriter, request *http.Request) {
socket, err := upgrader.Upgrade(writer, request)
Expand Down Expand Up @@ -254,13 +256,19 @@ func main() {
NewDialer: func() (gws.Dialer, error) {
return proxy.SOCKS5("tcp", "127.0.0.1:1080", nil, nil)
},
PermessageDeflate: gws.PermessageDeflate{
Enabled: true,
ServerContextTakeover: true,
ClientContextTakeover: true,
},
})
if err != nil {
log.Println(err.Error())
return
}
socket.ReadLoop()
}

```

#### 广播
Expand Down
1 change: 0 additions & 1 deletion autobahn/.gitignore

This file was deleted.

15 changes: 0 additions & 15 deletions autobahn/Makefile

This file was deleted.

26 changes: 0 additions & 26 deletions autobahn/config/fuzzingclient.json

This file was deleted.

9 changes: 0 additions & 9 deletions autobahn/config/fuzzingserver.json

This file was deleted.

Loading

0 comments on commit 826777e

Please sign in to comment.