sse问题
This commit is contained in:
parent
06c26fb6f7
commit
4d7240ea96
@ -20,11 +20,16 @@ export default function RechargeHead() {
|
||||
|
||||
// sse
|
||||
const initSse = () => {
|
||||
const evtSource = new EventSourcePolyfill(`${Axios.defaults.baseURL}/api/sse/connect`, {
|
||||
headers: {
|
||||
'X-USER-ID': DevUserId
|
||||
}
|
||||
});
|
||||
let evtSource;
|
||||
if(DevUserId) {
|
||||
evtSource = new EventSourcePolyfill(`${Axios.defaults.baseURL}/api/sse/connect`, {
|
||||
headers: {
|
||||
'X-USER-ID': DevUserId
|
||||
}
|
||||
});
|
||||
} else {
|
||||
evtSource = new EventSource(`${Axios.defaults.baseURL}/api/sse/connect`);
|
||||
}
|
||||
evtSource.onmessage = function (event:any) {
|
||||
const msg = JSON.parse(event.data) as SseMsg;
|
||||
if(msg.type === 'AMOUNT_RECEIVED') {
|
||||
|
@ -3,13 +3,13 @@ import type { MessageInstance } from "antd/es/message/interface";
|
||||
|
||||
export const Axios = axios;
|
||||
|
||||
// axios.defaults.baseURL = 'http://192.168.0.15:7025/copyright';
|
||||
axios.defaults.baseURL = 'http://192.168.0.15:7025/copyright';
|
||||
// axios.defaults.baseURL = 'http://192.168.43.145:7025/copyright';
|
||||
axios.defaults.baseURL = 'http://127.0.0.1:7025/copyright';
|
||||
// axios.defaults.baseURL = 'http://127.0.0.1:7025/copyright';
|
||||
// axios.defaults.baseURL = 'https://www.aimzhu.com/copyright';
|
||||
// axios.defaults.baseURL = '/copyright';
|
||||
export const WebSocketBaseUrl: string = 'ws://127.0.0.1:7025/copyright';
|
||||
// export const WebSocketBaseUrl: string = 'ws://192.168.0.15:7025/copyright';
|
||||
// export const WebSocketBaseUrl: string = 'ws://127.0.0.1:7025/copyright';
|
||||
export const WebSocketBaseUrl: string = 'ws://192.168.0.15:7025/copyright';
|
||||
// export const WebSocketBaseUrl: string = '/copyright';
|
||||
export const DevUserId: string = '80d3365e-0597-4988-979e-18ef1c3ec671'; // 18634604067
|
||||
// export const DevUserId: string = 'eb9a82a6-6ed3-4ba0-90e6-d836cefff915'; // 15042810561
|
||||
|
Loading…
Reference in New Issue
Block a user