game: add: online

This commit is contained in:
Namonay
2024-04-08 20:18:25 +02:00
parent bceb26790d
commit 9f5ca1430d
5 changed files with 202 additions and 117 deletions

View File

@ -1,6 +1,7 @@
import { AExchangeable } from "../AExchangable.js";
import { APlayer } from "./APlayer.js";
import { Client } from "../Client.js"
import { sleep } from "../../utils/sleep.js";
export class AGame extends AExchangeable
{
@ -96,10 +97,15 @@ export class AGame extends AExchangeable
*/
send(data)
{
if (this._socket === undefined || this._socket.readyState === WebSocket.OPEN)
return;
console.log(this._socket)
if (this._socket === undefined || this._socket.readyState !== WebSocket.OPEN)
{
console.log("bozo pas confirme")
return ;
}
console.log("j'essaye de send")
this._socket.send(data);
console.log("j'ai passer le send")
}
async join()