Skip to content

Commit

Permalink
fix conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
lxzan committed Nov 21, 2023
2 parents fc2092a + 30075f8 commit 7159f0d
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 31 deletions.
33 changes: 20 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,20 @@ to be processed in a non-blocking way.
### Why GWS

- <font size=3>Simplicity and Ease of Use</font>
- **User-Friendly**: Simple and clear `WebSocket` Event API design makes server-client interaction easy.
- **Code Efficiency**: Minimizes the amount of code needed to implement complex WebSocket solutions.

- **User-Friendly**: Simple and clear `WebSocket` Event API design makes server-client interaction easy.
- **Code Efficiency**: Minimizes the amount of code needed to implement complex WebSocket solutions.

- <font size=3>High-Performance</font>
- **High IOPS Low Latency**: Designed for rapid data transmission and reception, ideal for time-sensitive
applications.
- **Low Memory Usage**: Highly optimized memory multiplexing system to minimize memory usage and reduce your cost of ownership.

- **High IOPS Low Latency**: Designed for rapid data transmission and reception, ideal for time-sensitive
applications.
- **Low Memory Usage**: Highly optimized memory multiplexing system to minimize memory usage and reduce your cost of ownership.

- <font size=3>Reliability and Stability</font>
- **Robust Error Handling**: Advanced mechanisms to manage and mitigate errors, ensuring continuous operation.
- **Well-Developed Test Cases**: Passed all `Autobahn` test cases, fully compliant with `RFC 6455`. 99% unit test coverage, covering almost all conditional branches.
- **Robust Error Handling**: Advanced mechanisms to manage and mitigate errors, ensuring continuous operation.
- **Well-Developed Test Cases**: Passed all `Autobahn` test cases, fully compliant with `RFC 6455`. 99% unit test coverage, covering almost all conditional branches.

### Benchmark

#### IOPS (Echo Server)
Expand Down Expand Up @@ -66,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 @@ -76,10 +79,10 @@ PASS
- [Quick Start](#quick-start)
- [Best Practice](#best-practice)
- [More Examples](#more-examples)
- [KCP](#kcp)
- [Proxy](#proxy)
- [Broadcast](#broadcast)
- [Pub / Sub](#pub--sub)
- [KCP](#kcp)
- [Proxy](#proxy)
- [Broadcast](#broadcast)
- [Pub / Sub](#pub--sub)
- [Autobahn Test](#autobahn-test)
- [Communication](#communication)
- [Acknowledgments](#acknowledgments)
Expand Down Expand Up @@ -288,6 +291,10 @@ func Broadcast(conns []*gws.Conn, opcode gws.Opcode, payload []byte) {

#### Pub / Sub

Use the event_emitter package to implement the publish-subscribe model. Wrap `gws.Conn` in a structure and implement the GetSubscriberID method to get the subscription ID, which must be unique. The subscription ID is used to identify the subscriber, who can only receive messages on the subject of his subscription.

This example is useful for building chat rooms or push messages using gws. This means that a user can subscribe to one or more topics via websocket, and when a message is posted to that topic, all subscribers will receive the message.

```go
package main

Expand Down
41 changes: 23 additions & 18 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,19 @@ GWS(Go WebSocket)是一个用 Go 编写的非常简单、快速、可靠且
### 为什么选择 GWS

- <font size=3>简单易用</font>
- **用户友好**: 简单明了的 `WebSocket` 事件接口设计,让服务器和客户端的交互变得轻松简单.
- **编码效率**: 最大限度地减少实施复杂的解决方案所需的代码量.

- **用户友好**: 简洁明了的 `WebSocket` 事件接口设计,让服务器和客户端的交互变得轻松简单.
- **编码效率**: 最大限度地减少实施复杂的解决方案所需的代码量.

- <font size=3>性能出众</font>
- **高吞吐低延迟**: 专为快速传输和接收数据而设计,是时间敏感型应用的理想之选.
- **低内存占用**: 高度优化的内存复用系统, 最大限度降低内存占用,降低您的使用成本.

- **高吞吐低延迟**: 专为快速传输和接收数据而设计,是时间敏感型应用的理想之选.
- **低内存占用**: 高度优化的内存复用系统, 最大限度降低内存使用量,降低您的成本.

- <font size=3>稳定可靠</font>
- **健壮的错误处理**: 管理和减少错误的先进机制,确保持续运行.
- **完善的测试用例**: 通过了所有 `Autobahn` 测试用例, 完全符合 `RFC 6455` 标准. 单元测试覆盖率达到99%, 几乎覆盖所有条件分支.
- **健壮的错误处理**: 管理和减少错误的先进机制,确保持续运行.
- **完善的测试用例**: 通过了所有 `Autobahn` 测试用例, 完全符合 `RFC 6455` 标准. 单元测试覆盖率达到 99%, 几乎覆盖所有条件分支.

### 基准测试

#### IOPS (Echo Server)
Expand Down Expand Up @@ -59,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 @@ -69,15 +71,14 @@ PASS
- [快速上手](#快速上手)
- [最佳实践](#最佳实践)
- [更多用例](#更多用例)
- [KCP](#kcp)
- [代理](#代理)
- [广播](#广播)
- [发布订阅](#发布订阅)
- [KCP](#kcp)
- [代理](#代理)
- [广播](#广播)
- [发布/订阅](#发布订阅)
- [Autobahn 测试](#autobahn-测试)
- [交流](#交流)
- [致谢](#致谢)


### 特性

- [x] 事件驱动式 API
Expand All @@ -89,9 +90,9 @@ PASS

### 注意

- 所有 gws.Conn 导出的方法错误都是可忽略的, 它们在内部已经被妥善处理了
- 所有 gws.Conn 导出方法返回的错误都是可忽略的, 它们在内部已经被妥善处理了
- 传输大文件有阻塞连接的风险
- 如果复用HTTP服务器, 建议调用ReadLoop时开启新的goroutine, 以避免请求上下文内存不能被回收.
- 如果复用 HTTP 服务器, 建议开启新的 Goroutine 来调用 ReadLoop, 以避免请求上下文内存不能及时回收.

### 安装

Expand Down Expand Up @@ -237,7 +238,7 @@ func main() {

#### 代理

通过代理拨号, 使用socks5协议.
通过代理拨号, 使用 socks5 协议.

```go
package main
Expand Down Expand Up @@ -280,7 +281,11 @@ func Broadcast(conns []*gws.Conn, opcode gws.Opcode, payload []byte) {
}
```

#### 发布订阅
#### 发布/订阅

使用 event_emitter 包实现发布订阅模式。用结构体包装 `gws.Conn`,并实现 GetSubscriberID 方法以获取订阅 ID,该 ID 必须是唯一的。订阅 ID 用于识别订阅者,订阅者只能接收其订阅主题的消息。

此示例对于使用 gws 构建聊天室或消息推送非常有用。这意味着用户可以通过 websocket 订阅一个或多个主题,当向该主题发布消息时,所有订阅用户都会收到消息。

```go
package main
Expand Down

0 comments on commit 7159f0d

Please sign in to comment.