Merge pull request #184 from thecodingmachine/debugreconnect
Adding console log when trying to reconnect
This commit is contained in:
commit
b8f9e25b26
1 changed files with 16 additions and 1 deletions
|
@ -22,10 +22,13 @@ enum EventMessage{
|
||||||
WEBRTC_DISCONNECT = "webrtc-disconect",
|
WEBRTC_DISCONNECT = "webrtc-disconect",
|
||||||
GROUP_CREATE_UPDATE = "group-create-update",
|
GROUP_CREATE_UPDATE = "group-create-update",
|
||||||
GROUP_DELETE = "group-delete",
|
GROUP_DELETE = "group-delete",
|
||||||
|
SET_PLAYER_DETAILS = "set-player-details", // Send the name and character to the server (on connect), receive back the id.
|
||||||
|
|
||||||
CONNECT_ERROR = "connect_error",
|
CONNECT_ERROR = "connect_error",
|
||||||
RECONNECT = "reconnect",
|
RECONNECT = "reconnect",
|
||||||
SET_PLAYER_DETAILS = "set-player-details" // Send the name and character to the server (on connect), receive back the id.
|
RECONNECTING = "reconnecting",
|
||||||
|
RECONNECT_ERROR = "reconnect_error",
|
||||||
|
RECONNECT_FAILED = "reconnect_failed"
|
||||||
}
|
}
|
||||||
|
|
||||||
class Message {
|
class Message {
|
||||||
|
@ -309,6 +312,18 @@ export class Connection implements ConnectionInterface {
|
||||||
this.GameManager.switchToDisconnectedScene();
|
this.GameManager.switchToDisconnectedScene();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.getSocket().on(EventMessage.RECONNECTING, () => {
|
||||||
|
console.log('Trying to reconnect');
|
||||||
|
});
|
||||||
|
|
||||||
|
this.getSocket().on(EventMessage.RECONNECT_ERROR, () => {
|
||||||
|
console.log('Error while trying to reconnect.');
|
||||||
|
});
|
||||||
|
|
||||||
|
this.getSocket().on(EventMessage.RECONNECT_FAILED, () => {
|
||||||
|
console.error('Reconnection failed. Giving up.');
|
||||||
|
});
|
||||||
|
|
||||||
this.getSocket().on(EventMessage.RECONNECT, () => {
|
this.getSocket().on(EventMessage.RECONNECT, () => {
|
||||||
this.connectSocketServer();
|
this.connectSocketServer();
|
||||||
if (this.lastPositionShared === null) {
|
if (this.lastPositionShared === null) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue