因为SignalR将WebSocket做为底层传输方式的优先实现,须要配置Nginx 支持WebSocket(详见SignalR的介绍)html
浏览器兼容性测试:Chrome经过,360极速模式经过,360兼容模式不经过,Edge经过,IE 11 不经过。nginx
建议使用Chrome,360极速模式,Edge。web
错误解决汇总(Nginx支持WebSocket反向代理)promise
1 WebSocket connection to 'ws://localhost:8000/chat?id=a_' failed: Error during WebSocket handshake: Unexpected response code: 200。浏览器
缘由:未配置Nginx 支持WebSocket。服务器
解决:nginx.conf文件location(包含SingalR服务端转发)websocket
添加如下3行socket
# 启用支持websocket链接post
proxy_http_version 1.1; #若是没有这句,会产生409错误测试
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
2 WebSocket connection to 'ws://localhost:8000/chat?id=QRhslq' failed: Error during WebSocket handshake: Unexpected response code: 409。