跳到主要内容

im组件化开发

nginx

1、为了适应websocket协议 需要升级nginx的配置如下

http {

#为了适应websocket协议 升级配置
map $http_upgrade $connection_upgrade {
default keep-alive; #默认为keep-alive 可以支持 一般http请求
'websocket' upgrade; #如果为websocket 则为 upgrade 可升级的。
}


#API域名配置
server {
listen 80;
server_name 域名;

location / {
proxy_pass http://服务的ip:port;
proxy_set_header Host $host:$server_port;
proxy_pass_header User-Agent;
proxy_http_version 1.1;
#为了适应websocket协议 升级配置
proxy_set_header Upgrade $http_upgrade; #此处配置 上面定义的变量
proxy_set_header Connection $connection_upgrade;
}
}

ui

1、修改ui/manager-seller/config/index.js,将im值设置为true

2、修改ui/buyer/nuxt.config.js,将im值设置为true

uniapp

1、修改根目录/config/config.js,将im值设置为true