reconnect ws, closes #837

This commit is contained in:
Alexander Drozdov
2023-01-03 19:34:30 +02:00
parent b2905cbace
commit ad09e5ab59
4 changed files with 13 additions and 5 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "awakened-poe-trade",
"version": "3.20.10005",
"version": "3.20.10006",
"private": true,
"scripts": {
"dev": "node build/script.cjs",
+1
View File
@@ -17,6 +17,7 @@
"fast-deep-equal": "^3.1.3",
"luxon": "3.x.x",
"object-hash": "^3.0.0",
"sockette": "^2.0.6",
"tailwindcss": "3.x.x",
"tippy.js": "^6.2.7",
"vue": "3.2.x",
+6 -4
View File
@@ -1,15 +1,17 @@
import type { IpcEvent, IpcEventPayload } from '@ipc/types'
import { shallowRef } from 'vue'
import Sockette from 'sockette'
class HostTransport {
private evBus = new EventTarget()
private socket: WebSocket
private socket: Sockette
logs = shallowRef('')
constructor () {
this.socket = new WebSocket(`ws://${window.location.host}/events`)
this.socket.addEventListener('message', (e) => {
this.selfDispatch(JSON.parse(e.data))
this.socket = new Sockette(`ws://${window.location.host}/events`, {
onmessage: (e) => {
this.selfDispatch(JSON.parse(e.data))
}
})
this.onEvent('MAIN->CLIENT::log-entry', (entry) => {
this.logs.value += (entry.message + '\n')
+5
View File
@@ -1976,6 +1976,11 @@ slash@^3.0.0:
resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==
sockette@^2.0.6:
version "2.0.6"
resolved "https://registry.yarnpkg.com/sockette/-/sockette-2.0.6.tgz#63b533f3cfe3b592fc84178beea6577fa18cebf3"
integrity sha512-W6iG8RGV6Zife3Cj+FhuyHV447E6fqFM2hKmnaQrTvg3OydINV3Msj3WPFbX76blUlUxvQSMMMdrJxce8NqI5Q==
sortablejs@1.10.2:
version "1.10.2"
resolved "https://registry.yarnpkg.com/sortablejs/-/sortablejs-1.10.2.tgz#6e40364d913f98b85a14f6678f92b5c1221f5290"