awesome-im
Version:
Lightweight, extensible, JavaScript Instant Messaging.
76 lines (75 loc) • 1.42 kB
JavaScript
export const ConnectionStatus = {
/**
* 请求超时。
*/
TIMEOUT: -1,
/**
* 连接成功。
*/
CONNECTED: 0,
/**
* 连接中。
*/
CONNECTING: 1,
/**
* 正常断开连接。
*/
DISCONNECTED: 2,
/**
* 网络不可用。
*/
NETWORK_UNAVAILABLE: 3,
/**
* 连接关闭。
*/
CONNECTION_CLOSED: 4,
/**
* 用户账户在其他设备登录,本机会被踢掉线。
*/
KICKED_OFFLINE_BY_OTHER_CLIENT: 6,
/**
* websocket 连接失败
*/
WEBSOCKET_UNAVAILABLE: 7,
/**
* websocket 报错
*/
WEBSOCKET_ERROR: 8,
}
export const ErrorCode = {
/**
* 请求超时
*/
TIMEOUT: {
code: -1,
msg: 'Network timeout'
},
/**
* 操作成功
*/
SUCCESS: {
code: 0,
errMsg: "success"
},
/**
* 未连接
*/
NOT_CONNECTED: {
code: 10001,
errMsg: "not connect"
},
/**
* 服务端返回数据错误或者格式不正确
*/
SERVER_SEND_DATA_NOT_RIGHT: {
code: 10002,
errMsg: "SERVER SEND DATA NOT RIGHT"
},
/**
* 连接已存在,请勿重连
*/
CONNECTION_EXIST: {
code: 10003,
errMsg: "Connection already exists"
},
}