| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- import {defineStore} from 'pinia'
- import WsRequest from "@/api/WsRequest";
- import type Message from "@/mode/Message";
- import type Receipt from "@/mode/Receipt";
- import type Webrtc from '@/mode/Webrtc'
- export const useWsStore = defineStore({
- id: 'online_store',
- state: () => ({
- wsRequest: WsRequest.getInstance(),
- }),
- actions: {
- init(): void {
- this.wsRequest.init()
- },
- reconnect(): void {
- this.wsRequest.reconnect()
- },
- reset(): void {
- this.wsRequest.reset()
- },
- send(str: string): void {
- this.wsRequest.send(str)
- },
- close(closeByUser:boolean): void {
- this.wsRequest.close(closeByUser)
- },
- sendMessage(message: Message): void {
- this.wsRequest.sendMessage(message)
- },
- sendfileMessage(message: Message): void {
- this.wsRequest.sendfileMessage(message)
- },
- sendfileMsgFalse(message: Message): void {
- this.wsRequest.sendfileMsgFalse(message)
- },
- sendWEBRTC(message: Webrtc): void {
- this.wsRequest.sendWEBRTC(message)
- },
- sendWEBRTCresult(message: any): void {
- this.wsRequest.sendWEBRTCresult(message)
- },
- sendRead(receipt: Receipt): void {
- this.wsRequest.sendRead(receipt)
- },
- callBack(callback:() => void): void {
- this.wsRequest.callback = callback
- },
- checkStatus(): void {
- this.wsRequest.checkStatus()
- }
- }
- })
|