stuff
This commit is contained in:
parent
ef5aa469d5
commit
4dee8677df
1 changed files with 14 additions and 0 deletions
|
|
@ -73,6 +73,20 @@ class SocketService {
|
|||
this.socket.emit(event, data);
|
||||
}
|
||||
|
||||
onReconnect(callback) {
|
||||
if (!this.socket) {
|
||||
this.connect();
|
||||
}
|
||||
// Слушаем событие 'connect' которое происходит при переподключении
|
||||
this.socket.on('connect', callback);
|
||||
}
|
||||
|
||||
offReconnect(callback) {
|
||||
if (this.socket) {
|
||||
this.socket.off('connect', callback);
|
||||
}
|
||||
}
|
||||
|
||||
// Game-specific methods
|
||||
joinRoom(roomCode, userId) {
|
||||
this.emit('joinRoom', { roomCode, userId });
|
||||
|
|
|
|||
Loading…
Reference in a new issue