Merge branch 'master' into 'dev'
# Conflicts: # src/lib/core/handlers/adbPayloadHandler.ts # src/lib/core/handlers/messageHandler.ts # src/routes/(authed)/tools/brew/+page.svelte
This commit is contained in:
commit
58b496d5c8
9 changed files with 304 additions and 42 deletions
|
|
@ -23,6 +23,17 @@ export const recipeOverviewData = writable<RecipeOverview[] | null>(null);
|
|||
export const materialData = writable<Material | undefined>();
|
||||
// price from recipe repo
|
||||
export const priceRecipeData = writable<{ [key: string]: any }>({});
|
||||
export const lastRequestSheetPrice = writable<{ [key: string]: any }>({});
|
||||
|
||||
// Streaming raw
|
||||
export const streamingRawData = writable<{ [key: string]: any }>({});
|
||||
export const streamingRawMeta = writable<{
|
||||
id: string;
|
||||
total_size: number;
|
||||
chunk_size: number;
|
||||
progress: number;
|
||||
country?: string;
|
||||
} | null>(null);
|
||||
|
||||
// machine recipe
|
||||
export const recipeFromMachine = writable<any>(null);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import { permission } from './permissions';
|
|||
|
||||
let socket: WebSocket | null = null;
|
||||
let reconnectTimeout: any;
|
||||
let socketCheck: any;
|
||||
const ENABLE_WS_DEBUG: boolean = false;
|
||||
|
||||
export const socketConnectionOfflineCount = writable<number>(0);
|
||||
|
|
@ -95,7 +96,7 @@ export function connectToWebsocket(id_token?: string) {
|
|||
console.log(socket);
|
||||
|
||||
// heartbeat 10s
|
||||
setInterval(() => {
|
||||
socketCheck = setInterval(() => {
|
||||
if (get(socketAlreadySendHeartbeat) > 0) {
|
||||
let heartbeat_may_offline_count = get(socketConnectionOfflineCount);
|
||||
|
||||
|
|
@ -143,6 +144,8 @@ export function connectToWebsocket(id_token?: string) {
|
|||
socketStore.set(null);
|
||||
socket = null;
|
||||
|
||||
clearInterval(socketCheck);
|
||||
|
||||
if (auth.currentUser && !socket) {
|
||||
console.log('try reconnect websocket ...');
|
||||
// retry again
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue