Commit 335fb03d authored by Bill's avatar Bill

fix: 修改socket参数

parent a5e388c5
export const NOT_CHANGE_VALUE = 'hello, world'
// socket的链接地址, 默认会使用后端接口网关地址
export const SOCKET_URL = process.env.SOCKET_URL?.replace('http|https', 'ws') || process.env.BACK_GATEWAY?.replace('http|https', 'ws') || "ws://10.0.0.25:9400"
export const SOCKET_URL = process.env.SOCKET_URL?.replace('http|https', 'ws') || process.env.BACK_GATEWAY?.replace('http|https', 'ws')
console.log(SOCKET_URL);
export const MALL_TYPE = {
......
......@@ -31,8 +31,8 @@ const GlobalHeaderRight: React.FC<{}> = (props) => {
const ws = useRef<WebSocket | null>(null);
const webSocketInit = useCallback(() => {
console.log(ws.current)
if ((!ws.current || ws.current.readyState === 3) && userInfo) {
const url = `${SOCKET_URL}/report/websocket?memberId=${userInfo.memberId}&roleId=${userInfo.memberRoleId}&token=${userInfo.token}`;
if (SOCKET_URL && (!ws.current || ws.current.readyState === 3) && userInfo) {
const url = `${SOCKET_URL}/report/websocket?memberId=${userInfo.memberId}&roleId=${userInfo.memberRoleId}&token=${userInfo.token}&source=${1}`;
ws.current = new WebSocket(url);
ws.current.onopen = (e) => {
console.log(e)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment