useWebSocket 的主要参数包括 WebSocket 的 URL 和一个可选的配置对象。配置对象中可以包含以下配置项: onOpen:当 WebSocket 连接成功建立时触发的回调函数。 onMessage:当 WebSocket 接收到消息时触发的回调函数,回调函数接收一个事件对象,其中包含了接收到的消息数据。 onClose:当 WebSocket 连接关闭时触发的回调函数...
:(ws:WebSocket)=>void// Callback on successful connectiononClose?:(ws:WebSocket,event:CloseEvent)=>void// Callback on connection closureonError?:(ws:WebSocket,event:Event)=>void// Callback on error occurrenceonFail?:()=>void// Callback on reconnection failureonMessage?:(ws:WebSocket,event:...
socket.close(); }); return { sendMessage, message, error, isOpen, isClosed, handleOpen, handleClose, handleError, handleMessage, }; } ''' 这个'useWebSocket' 方法接受一个 'url' 参数,并返回一些相关的属性和方法,包括 'sendMessage' 方法用于发送消息,'message' 和 'error' 用于存储接收到的消息...
867 new files uploaded 280 generated pages and 587 assets changed. Details Changed pages include: There are more changes not included in the list
As the VueUse audience continues to grow, we have been inundated with an overwhelming number of feature requests and pull requests. As a result, maintaining the project has become increasingly challenging and has stretched our capacity to its limits. As such, in the near future, we may need ...
fix: transpile target toes2018, close #3349 2年前 taze.config.ts chore: update deps 1年前 tsconfig.json fix(useWebSocket): webworker support (#3469) 1年前 unocss.config.ts feat(useAsyncValidator): add immediate and execute (#2899) ...
fix(useWebSocket): webworker support (#3469) 1年前 unocss.config.ts fix(useRafFn): fixfpsLimitoption, fix #3481, close #3482 1年前 vitest.config.ts chore: update deps 2年前 README MIT Collection of essential Vue Composition Utilities ...
socketRef.value.close(); } }); return { messages, errors, sendMessage }; } 在你的Vue组件中,你可以引入并使用useWebSocket方法,如下所示: javascript复制代码: import { useWebSocket } from './useWebSocket'; import { onMounted, onBeforeUnmount } from 'vue'; export default { setup() { const...
@@ -231,7 +231,7 @@ export function useWebSocket<Data = any>( status.value = 'CLOSED' onDisconnected?.(ws, ev) if (!explicitlyClosed && options.autoReconnect && ws === wsRef.value) { if (!explicitlyClosed && options.autoReconnect && (wsRef.value == null || ws === wsRef.value...
useWebSocket: Close socket connection inside WebWorker fix - by@catzin#4229(ece6a) View changes on GitHub Assets2 👍2ShaneLee-9 and sadeghbarati reacted with thumbs up emoji🎉7syahrizaldev, agantelin, BobbieGoede, brolnickij, NaokiHaba, sadeghbarati, and fmeyertoens reacted with hooray...