Skip to content

Commit

Permalink
docs(useWebSocket): remove invalid type definition in demo (#2739)
Browse files Browse the repository at this point in the history
Co-authored-by: 丶远方 <pantengyang@cybstar.com>
  • Loading branch information
Alfred-Skyblue and 丶远方 committed Feb 14, 2023
1 parent 08979cc commit 4fc8ad9
Showing 1 changed file with 0 additions and 101 deletions.
101 changes: 0 additions & 101 deletions packages/core/useWebSocket/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,107 +78,6 @@ const { status, data, close } = useWebSocket('ws://websocketurl', {
})
```

<!--FOOTER_STARTS-->
## Type Declarations

```typescript
export declare type WebSocketStatus = "OPEN" | "CONNECTING" | "CLOSED"
export interface WebSocketOptions {
onConnected?: (ws: WebSocket) => void
onDisconnected?: (ws: WebSocket, event: CloseEvent) => void
onError?: (ws: WebSocket, event: Event) => void
onMessage?: (ws: WebSocket, event: MessageEvent) => void
/**
* Send heartbeat for every x mileseconds passed
*
* @default false
*/
heartbeat?:
| boolean
| {
/**
* Message for the heartbeat
*
* @default 'ping'
*/
message?: string | ArrayBuffer | Blob
/**
* Interval, in mileseconds
*
* @default 1000
*/
interval?: number
}
/**
* Enabled auto reconnect
*
* @default false
*/
autoReconnect?:
| boolean
| {
/**
* Maximum retry times.
*
* @default -1
*/
retries?: number
/**
* Delay for reconnect, in mileseconds
*
* @default 1000
*/
delay?: number
/**
* On maximum retry times reached.
*/
onFailed?: Fn
}
}
export interface WebSocketResult<T> {
/**
* Reference to the latest data received via the websocket,
* can be watched to respond to incoming messages
*/
data: Ref<T | null>
/**
* The current websocket status, can be only one of:
* 'OPEN', 'CONNECTING', 'CLOSED'
*/
status: Ref<WebSocketStatus>
/**
* Closes the websocket connection gracefully.
*/
close: WebSocket["close"]
/**
* Reopen the websocket connection.
* If there the current one is active, will close it before opening a new one.
*/
open: Fn
/**
* Sends data through the websocket connection.
*
* @param data
* @param useBuffer when the socket is not yet open, store the data into the buffer and sent them one connected. Default to true.
*/
send: (data: string | ArrayBuffer | Blob, useBuffer?: boolean) => boolean
/**
* Reference to the WebSocket instance.
*/
ws: Ref<WebSocket | undefined>
}
/**
* Reactive WebSocket client.
*
* @see {@link https://vueuse.org/useWebSocket}
* @param url
*/
export declare function useWebSocket<Data = any>(
url: MaybeComputedRef<string | URL | undefined>,
options?: WebSocketOptions
): WebSocketResult<Data>
```

### Sub-protocols

List of one or more subprotocols to use, in this case soap and wamp.
Expand Down

0 comments on commit 4fc8ad9

Please sign in to comment.