修改websocket日志

This commit is contained in:
whyour
2021-10-21 21:52:06 +08:00
parent d0a7e67138
commit 04230cbd1c
5 changed files with 28 additions and 12 deletions
+7 -5
View File
@@ -127,13 +127,15 @@ export default function (props: any) {
ws.current = new SockJS(
`${location.origin}/api/ws?token=${localStorage.getItem(config.authKey)}`,
);
ws.current.onopen = (e: any) => {
console.log('websocket连接成功', e);
ws.current.onmessage = (e: any) => {
if (e.data === 'hanhh') {
console.log('websocket连接成功', e);
} else {
console.log('websocket连接失败', e);
}
};
ws.current.onclose = (e: any) => {
console.log('websocket已关闭', e);
};
const wsCurrent = ws.current;
return () => {