You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

32 lines
741 B

import { WebSocketClient as WSClient } from "@autoplex/websocket-client";
import store, { Action } from "./store";
class WebSocketClient extends WSClient
{
/**
* Setup the socket
*/
protected setup() {
store.watch(state => state.user, () => this.authStateChanged());
setTimeout(async () => {
let result = await this.request("test", "snthaoeu onstehu soehu soeuh ou");
console.log("The result is:", result);
}, 5000);
}
/**
* Get the app's current auth JWT
*/
protected jwt() {
return store.state.user?.token ?? null;
}
/**
* Forget the JWT and log out of the app
*/
protected forgetJwt() {
store.dispatch(Action.AuthForget, undefined);
}
}
export default new WebSocketClient("ws://localhost:3250/");