fix broken things

main
easrng 2022-02-18 17:13:49 -05:00
parent 2adc8b9d02
commit c8ccb7afc4
2 changed files with 3 additions and 5 deletions

View File

@ -11,7 +11,6 @@ export default class ReconnectingWebSocket {
this._lastConnect = 0; this._lastConnect = 0;
this._socket = null; this._socket = null;
this._unsent = []; this._unsent = [];
this._connect(true);
} }
_connect(first) { _connect(first) {
if (this._socket) if (this._socket)
@ -26,9 +25,9 @@ export default class ReconnectingWebSocket {
} }
this._socket.addEventListener("close", () => this._reconnect()); this._socket.addEventListener("close", () => this._reconnect());
this._socket.addEventListener("error", () => this._reconnect()); this._socket.addEventListener("error", () => this._reconnect());
this._socket.addEventListener("message", ({ data }) => this._socket.addEventListener("message", ({ data }) => {
this._eventTarget.dispatchEvent(new MessageEvent("message", { data })) this._eventTarget.dispatchEvent(new MessageEvent("message", { data }));
); });
this._socket.addEventListener("open", (e) => { this._socket.addEventListener("open", (e) => {
if (first) this._eventTarget.dispatchEvent(new Event("open")); if (first) this._eventTarget.dispatchEvent(new Event("open"));
if (this._reconnecting) if (this._reconnecting)

View File

@ -71,7 +71,6 @@ const setupIncomingEvents = (video, socket) => {
socket.addEventListener("message", async (messageEvent) => { socket.addEventListener("message", async (messageEvent) => {
try { try {
const event = JSON.parse(messageEvent.data); const event = JSON.parse(messageEvent.data);
if (!event.reflected) { if (!event.reflected) {
switch (event.op) { switch (event.op) {
case "SetPlaying": case "SetPlaying":