This repository has been archived on 2021-11-25. You can view files and clone it, but cannot push or open issues or pull requests.
BookFloatingServer/Rule.md
2017-03-09 12:59:15 +08:00

86 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# BookFloatingServer服务端通信准则草稿
## 版本v1.0 (20170308)
整个通信采用TCP-Socket连接地址gameharbor.cn 端口55555
### 消息次序
> 客户端先发送JSON字符串服务器进行操作后返回JSON字符串.
> 客户端可随时断开连接,但此连接将不可恢复.
### JSON标准
#### 注册
字段 | 值
-----|----
type | register必须
email | 注册用户Email
nickname | 昵称
school | 学校
pwass | 登录密码(明文)
示例
```
{'type':'register','email':'test@163.com','nickname':'Kirito','school':'QUST','pwass':'dvaLovesU'}
```
**返回值**
字段 | 值
---|---
ret|操作返回值(一般为1时是正常的)
**示例**
```
{'ret':'1'}
```
#### 登录
字段 | 值
---|---
type | login必须
email | 注册时Email
pwass | 登录密码(明文)
**示例**
```
{'type':'login','email':'test@163.com','pwass':'dvaLovesU'}
```
**返回值**
字段|值
---|---
ret|操作返回值(0时为正常)
**示例**
```
{'ret':'0'}
```
#### 上传
字段|值
---|---
type| upload必须
bookname|书名
author|作者
context|内容简介
imageURL|图片地址
**示例**
```
{'type':'upload','bookname':'TAOCP-1','author':'Unknown','context':'This is a good book','imageURL':'pic/upl01.png'}
```
**返回值**
字段|值
---|---
ret|操作返回值(大部分情况下1代表正常)
**示例**
```
{'ret':'1'}
```