# websocket_server **Repository Path**: gaolegaole/websocket_server ## Basic Information - **Project Name**: websocket_server - **Description**: websocket订单通知服务器 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-06-12 - **Last Updated**: 2021-07-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 1. 创建.env文件 ``` host=http://localhost #websocket访问网址 port=8080 #node运行端口 redis_host=192.168.10.10 #redis地址,一般为localhost redis_post=6379 #redis运行端口 channel=order #redis订阅的频道 ``` 2. npm run serv 3. 将host反向代理到nginx 4. 使用socket.io客户端连接 ``` socket = io('http://localhost'); socket.on('news', (data) => { console.log(data); }); ```