docs: update wg-basic/websocket
This commit is contained in:
parent
6973ec81ba
commit
bd305f7708
@ -2,13 +2,42 @@
|
||||
title: 即时消息
|
||||
description: 即时消息模块的使用
|
||||
published: true
|
||||
date: 2021-09-14T06:25:26.887Z
|
||||
date: 2021-09-14T06:44:48.671Z
|
||||
tags: wg-basic
|
||||
editor: markdown
|
||||
dateCreated: 2021-09-14T06:25:26.887Z
|
||||
---
|
||||
|
||||
# 依赖模块
|
||||
```xml
|
||||
|
||||
```
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>ink.wgink</groupId>
|
||||
<artifactId>module-instant-message</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
# 配置
|
||||
|
||||
```yml
|
||||
websocket:
|
||||
url: 127.0.0.1
|
||||
port: 8081
|
||||
# 上下文
|
||||
context: websocket
|
||||
```
|
||||
|
||||
# 如何对接
|
||||
|
||||
1. 不论后台还是APP,首先需要完成登录
|
||||
2. 请求接口完成socket登录
|
||||
|
||||
- 后台请求接口:`api/websocket/client/login/{clientName}`
|
||||
- APP请求接口:`app/websocket/client/login/{clientName}`
|
||||
- 请求方法:GET
|
||||
- clientName:客户端名称(唯一标识,非中文)
|
||||
|
||||
3. 请求接口后,拿到会话ID(sessionId)
|
||||
4. 初始化 WebSocket
|
||||
5. 连接打开后,发起 **会话注册**,携带请求后的 sessionId
|
Loading…
Reference in New Issue
Block a user