whyczyk
2021-10-08 b77a08b70d8fc45ce700d8fc86e53503e9a8ec05
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;