Skip to content

Commit 9cb67eb

Browse files
author
yinlong
committed
readme
1 parent abfb970 commit 9cb67eb

File tree

2 files changed

+19
-46
lines changed

2 files changed

+19
-46
lines changed

README.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
<img src="https://s1.ax1x.com/2020/08/21/dYIAQU.png" width=20%/>
66
</div>
77

8-
[![openupm](https://img.shields.io/npm/v/com.psygame.unitywebsocket?label=openupm&registry_uri=https://package.openupm.com)](https://openupm.com/packages/com.psygame.unitywebsocket/)
9-
108
## **在线示例**
119

1210
- **[https://psygames.github.io/UnityWebSocket/](https://psygames.github.io/UnityWebSocket/)**
@@ -16,14 +14,7 @@
1614

1715
### **安装方法**
1816

19-
- **通过 Package Manager 安装**
20-
21-
***待添加***
22-
23-
24-
- **通过 Unity Package 安装**
25-
26-
[Releases](https://github.com/psygames/UnityWebSocket/releases) 页面中,下载对应版本的 `UnityWebSocket.unitypackage` 安装包,然后导入到您的项目中。
17+
-[Releases](https://github.com/psygames/UnityWebSocket/releases) 页面中,下载对应版本的 `UnityWebSocket.unitypackage` 安装包,然后导入到您的项目中。
2718

2819

2920
### **使用方法**
@@ -50,14 +41,19 @@
5041
// 发送 string 类型数据
5142
socket.SendAsync(str);
5243

53-
// 或者 发送 byte[] 类型数据
44+
// 或者 发送 byte[] 类型数据(建议使用)
5445
socket.SendAsync(bytes);
5546

5647
// 关闭连接
5748
socket.CloseAsync();
5849
```
5950

60-
- 详细使用方法可参考项目中的 [UnityWebSocketDemo.cs](Assets/UnityWebSocket/Samples~/Demo/UnityWebSocketDemo.cs) 示例代码。
51+
- 更多使用方法可参考项目中的 [UnityWebSocketDemo.cs](Assets/UnityWebSocket/Demo/UnityWebSocketDemo.cs) 示例代码。
52+
53+
- 可添加 Unity 编译宏:
54+
- `UNITY_WEB_SOCKET_LOG` 打开底层日志输出。
55+
- `UNITY_WEB_SOCKET_SHARP` 使用 [websocket-sharp](https://github.com/sta/websocket-sharp) 插件。
56+
- `UNITY_WEB_SOCKET_NINJA` 使用 [Ninja.WebSockets](https://github.com/ninjasource/Ninja.WebSockets) 插件。
6157

6258

6359
### **注意(Warning)**

README_EN.md

Lines changed: 11 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,16 @@
55
<img src="https://s1.ax1x.com/2020/08/21/dYIAQU.png" width=20%/>
66
</div>
77

8-
[![openupm](https://img.shields.io/npm/v/com.psygame.unitywebsocket?label=openupm&registry_uri=https://package.openupm.com)](https://openupm.com/packages/com.psygame.unitywebsocket/)
9-
108
## **Online Demo**
119

1210
- **[https://psygames.github.io/UnityWebSocket/](https://psygames.github.io/UnityWebSocket/)**
1311

1412

1513
## **Quick Start**
1614

17-
### **Requirements**
18-
19-
- Unity 2018.3 or later
20-
- No other SDK are required
21-
2215
### **Installation**
2316

24-
- **Using OpenUPM**
25-
26-
This package is available on [OpenUPM](https://openupm.com/packages/com.psygame.unitywebsocket/). You can install it via [openupm package installer](https://package-installer.glitch.me/v1/installer/OpenUPM/com.psygame.unitywebsocket?registry=https%3A%2F%2Fpackage.openupm.com).
27-
28-
- **Using Git**
29-
30-
Find the manifest.json file in the Packages folder of your project and edit it to look like this:
31-
```js
32-
{
33-
"dependencies": {
34-
"com.psygame.unitywebsocket": "https://github.com/psygames/UnityWebSocket.git",
35-
...
36-
},
37-
}
38-
```
39-
40-
To update the package, change suffix `#{version}` to the target version.
41-
* e.g. `"com.psygame.unitywebsocket": "https://github.com/psygames/UnityWebSocket.git#2.3.0",`
42-
43-
- **Using Unity Package**
44-
45-
Download an `UnityWebSocket.unitypackage` file from [Releases](https://github.com/psygames/UnityWebSocket/releases) page.
17+
- Download an `UnityWebSocket.unitypackage` file from [Releases](https://github.com/psygames/UnityWebSocket/releases) page.
4618
Import it into your Unity project.
4719

4820

@@ -67,16 +39,21 @@
6739
// connect
6840
socket.ConnectAsync();
6941

70-
// send data (two ways)
71-
socket.SendAsync(str); // send string data
72-
socket.SendAsync(bytes); // send byte[] data
42+
// send string data
43+
socket.SendAsync(str);
44+
// or send byte[] data (suggested)
45+
socket.SendAsync(bytes);
7346

7447
// close connection
7548
socket.CloseAsync();
7649
```
7750

78-
- more detail usage, see the [UnityWebSocketDemo.cs](Samples~/Demo/UnityWebSocketDemo.cs) code in project。
79-
51+
- more detail usage, see the [UnityWebSocketDemo.cs](Assets/UnityWebSocket/Demo/UnityWebSocketDemo.cs) code in project.
52+
53+
- Unity Define Symbols:
54+
- `UNITY_WEB_SOCKET_LOG` open internal log info.
55+
- `UNITY_WEB_SOCKET_SHARP` use third-party plugin [websocket-sharp](https://github.com/sta/websocket-sharp).
56+
- `UNITY_WEB_SOCKET_NINJA` use third-party plugin [Ninja.WebSockets](https://github.com/ninjasource/Ninja.WebSockets)
8057

8158
### **Attention(Warning)**
8259

0 commit comments

Comments
 (0)