1
2
3
4
5
6
7
8
9
10
11
12
13
14
| /**
| * 获取Websocket的连接
| * @param action
| * @returns {string}
| */
| function getWsUrl(action, port) {
| let _port = port?port:8091;
| let hostname = window.location.hostname;
| if(process.env.NODE_ENV == 'dev') {
| hostname = "localhost";
| }
| return 'ws://' + hostname+':' + _port + action;
| }
| export default getWsUrl;
|
|