mirror of
https://github.com/yawaflua/LuckyDiamond.git
synced 2025-12-10 12:19:31 +02:00
update socket on jackpot
This commit is contained in:
@@ -28,11 +28,14 @@ export function ConnectToChat() {
|
||||
eventBus.emit('dataChat', event.data);
|
||||
console.log('CHAT')
|
||||
}
|
||||
else {
|
||||
|
||||
if (data.MessageType == "CrashGameState") {
|
||||
eventBus.emit('crash', event.data)
|
||||
}
|
||||
|
||||
// console.log('Message from Server:', event.data);
|
||||
if (Array.isArray(data.CurrentGame.PlayerList)) {
|
||||
eventBus.emit('jackpotGameTik', event.data)
|
||||
}
|
||||
};
|
||||
|
||||
webSocket.onclose = function () {
|
||||
|
||||
@@ -1,59 +1,59 @@
|
||||
import { BackendWebSocketJackpotUrl } from '@/properties/Сonfig.js';
|
||||
// import { BackendWebSocketJackpotUrl } from '@/properties/Сonfig.js';
|
||||
import { BackendApiUrl } from '@/properties/Сonfig.js';
|
||||
import { eventBus } from "@/main";
|
||||
// import { eventBus } from "@/main";
|
||||
|
||||
// import {
|
||||
// GetCookie
|
||||
// } from "@/assets/js/storage/CookieStorage.js";
|
||||
|
||||
let webSocket;
|
||||
// let webSocket;
|
||||
|
||||
export function ConnectToJackpotSocket() {
|
||||
try {
|
||||
// export function ConnectToJackpotSocket() {
|
||||
// try {
|
||||
|
||||
if (webSocket && webSocket.readyState === WebSocket.OPEN) {
|
||||
console.log('WebSocket connection already established.');
|
||||
return;
|
||||
}
|
||||
// if (webSocket && webSocket.readyState === WebSocket.OPEN) {
|
||||
// console.log('WebSocket connection already established.');
|
||||
// return;
|
||||
// }
|
||||
|
||||
webSocket = new WebSocket(BackendWebSocketJackpotUrl);
|
||||
// webSocket = new WebSocket(BackendWebSocketJackpotUrl);
|
||||
|
||||
webSocket.onopen = function () {
|
||||
console.log('Connection established');
|
||||
};
|
||||
// webSocket.onopen = function () {
|
||||
// console.log('Connection established');
|
||||
// };
|
||||
|
||||
webSocket.onmessage = function (event) {
|
||||
// webSocket.onmessage = function (event) {
|
||||
|
||||
// const dataObject = JSON.parse(event.data);
|
||||
// // const dataObject = JSON.parse(event.data);
|
||||
|
||||
eventBus.emit('jackpotGameTik', event.data);
|
||||
// eventBus.emit('jackpotGameTik', event.data);
|
||||
|
||||
// console.log(dataObject)
|
||||
// if (dataObject && Object.prototype.hasOwnProperty.call(dataObject, 'SpUserName') && Object.prototype.hasOwnProperty.call(dataObject, 'Message')) {
|
||||
// eventBus.emit('dataChat', event.data);
|
||||
// console.log('CHAT')
|
||||
// }
|
||||
// else {
|
||||
// eventBus.emit('crash', event.data)
|
||||
// }
|
||||
// // console.log(dataObject)
|
||||
// // if (dataObject && Object.prototype.hasOwnProperty.call(dataObject, 'SpUserName') && Object.prototype.hasOwnProperty.call(dataObject, 'Message')) {
|
||||
// // eventBus.emit('dataChat', event.data);
|
||||
// // console.log('CHAT')
|
||||
// // }
|
||||
// // else {
|
||||
// // eventBus.emit('crash', event.data)
|
||||
// // }
|
||||
|
||||
};
|
||||
// };
|
||||
|
||||
webSocket.onclose = function () {
|
||||
// webSocket.onclose = function () {
|
||||
|
||||
webSocket = new WebSocket(BackendWebSocketJackpotUrl);
|
||||
// webSocket = new WebSocket(BackendWebSocketJackpotUrl);
|
||||
|
||||
console.log('Connection closed and reconnected');
|
||||
};
|
||||
// console.log('Connection closed and reconnected');
|
||||
// };
|
||||
|
||||
webSocket.onerror = function (event) {
|
||||
webSocket = new WebSocket(BackendWebSocketJackpotUrl);
|
||||
console.error('WebSocket Error:', event);
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('Error in ConnectToChat:', error);
|
||||
}
|
||||
}
|
||||
// webSocket.onerror = function (event) {
|
||||
// webSocket = new WebSocket(BackendWebSocketJackpotUrl);
|
||||
// console.error('WebSocket Error:', event);
|
||||
// };
|
||||
// } catch (error) {
|
||||
// console.error('Error in ConnectToChat:', error);
|
||||
// }
|
||||
// }
|
||||
|
||||
export async function JoinJackpotGame(userData, amount) {
|
||||
const data = {
|
||||
|
||||
Reference in New Issue
Block a user