|
@@ -18,10 +18,20 @@ export function openWS({ examRecordDataId }) {
|
|
|
action: "准备连接",
|
|
|
examRecordDataId,
|
|
|
});
|
|
|
- ws = new WebSocket(
|
|
|
- VUE_APP_WK_SERVER_SOCKET_FOR_AUDIO +
|
|
|
- `?key=${store.state.user.key}&token=${store.state.user.token}`
|
|
|
- );
|
|
|
+ try {
|
|
|
+ ws = new WebSocket(
|
|
|
+ VUE_APP_WK_SERVER_SOCKET_FOR_AUDIO +
|
|
|
+ `?key=${store.state.user.key}&token=${store.state.user.token}`
|
|
|
+ );
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ Message.error({
|
|
|
+ content: "Websocket初始化失败",
|
|
|
+ duration: 5,
|
|
|
+ closable: true,
|
|
|
+ });
|
|
|
+ console.log("WS init failed", examRecordDataId);
|
|
|
+ }
|
|
|
|
|
|
ws.onopen = (event) => {
|
|
|
console.log("open ws", event);
|