This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 运行环境 | |
* [nodejs-v0.10.*](https://nodejs.org/en/download/releases/) | |
* Windows、Linux 或 MacOS 操作系统 | |
* [mongodb]((https://www.mongodb.org/)) | |
* [redis](http://redis.io/download) | |
# 部署服务端 | |
## 下载源码 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#580服务端代码结构 | |
---------- | |
主要包括: 服务器代码http-server和socket.io-server. http-server是项目主要逻辑服务端, 负责项目的具体逻辑.socket.io-server是项目聊天服务器, 负责用户相关通讯 | |
##http-server服务端代码分析 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 聊天模块代码结构 | |
---------- | |
## 路由层 | |
路由层主要包括: 居民通讯,医生通讯两个部分 | |
### 居民通讯分析 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: mongodb3.* 设置用户认证 | |
date: 2016-03-27 20:07:43 | |
tags: [mongodb] | |
categories: [mongodb] | |
--- | |
#mongodb3.* 设置用户认证 | |
1、mongodb是没有默认管理员账号,所以要先添加管理员账号,在开启权限认证。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 聊天模块通讯管理 | |
---------- | |
## socket现有管理方案 | |
### 连接socket管理 | |
###### `(1. socket.io的封装,目前在/model/socketio/,socket.io服务是承载在默认3001端口(配置在/model/config/index)的http server上,socket事件的监听模式是怎样?)` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 我的方案 | |
#### 连接socket管理 | |
采用和原先系统一样的方式,也是保存在内存里面.之前做得项目也都是放在内存里面的. | |
研究过保存到redis中,但是redis本身并不适合存储复杂的数据结构,所以socket管理一般都是放在本地内存里的 | |
参考资料: | |
https://stackoverflow.com/questions/9459814/storing-and-retrieving-sockets-in-redis/9459982#9459982 | |
#### 通讯协议更改?? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 通讯协议相关业务逻辑 | |
###### `(3. socket消息的定义在/model/config/protocol中,各个事件对应的业务在哪些接口或模块?各自的业务流程和场景是怎样的?)` | |
### C2S_REGISTER_REQ :注册身份请求 | |
用户登陆时,客户端发送`C2S_REGISTER_REQ`socketio协议请求: | |
``` | |
message_sign.send({ | |
type: MsgType.C2S_REGISTER_REQ, | |
data:{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 运行环境 | |
* [nodejs-v4.4.2 LTS](https://nodejs.org/en/download/releases/) | |
* Windows、Linux 或 MacOS 操作系统 | |
* [mongodb-v3.2.1]((https://www.mongodb.org/)) | |
* [redis-v3.*](http://redis.io/download) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 运行环境 | |
* [nodejs-v4.4.2 LTS](https://nodejs.org/en/download/releases/) | |
* Windows、Linux 或 MacOS 操作系统 | |
* [mongodb-v3.2.1]((https://www.mongodb.org/)) | |
* [redis-v3.*](http://redis.io/download) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## socket连接通讯错误 | |
### 问题描述: | |
一个网页医生端登陆一个账号 | |
一个居民端登陆一个账号 | |
使用另一个手机医生端登陆之前的医生账号,网页端有异地提示 | |
再网页医生端重新登陆,手机端有异地提示 | |
再使用手机医生端重新登陆,没有异地提示,为什么? | |
居民发送消息,也不会在最新登陆的医生显示,而在之前的医生那里,为什么??? |