mirror of
https://github.com/sbrl/Nibriboard.git
synced 2018-01-10 21:33:49 +00:00
[client] Tentatively fix reconnect-on-refresh issue by removing the websocket close handler when disconnecting in beforeunload.
This commit is contained in:
parent
7a6d758e92
commit
b55ba73c57
2 changed files with 5 additions and 2 deletions
|
@ -23,7 +23,8 @@ class RippleLink extends EventEmitter
|
|||
// Attach some event listeners
|
||||
this.websocket.addEventListener("open", this.handleConnection.bind(this));
|
||||
this.websocket.addEventListener("message", this.handleMessage.bind(this));
|
||||
this.websocket.addEventListener("close", this.handleDisconnection.bind(this));
|
||||
let closeHandler = this.handleDisconnection.bind(this);
|
||||
this.websocket.addEventListener("close", closeHandler);
|
||||
|
||||
// Respond to heartbeats from the server
|
||||
this.on("Heartbeat", this.handleHeartbeat.bind(this));
|
||||
|
@ -31,6 +32,8 @@ class RippleLink extends EventEmitter
|
|||
|
||||
// Close the socket correctly
|
||||
window.addEventListener("beforeunload", (function(event) {
|
||||
// Remove the event listener to avoid issues on refresh
|
||||
this.websocket.removeEventListener("close", closeHandler);
|
||||
this.websocket.close();
|
||||
}).bind(this));
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace Nibriboard.RippleSpace
|
|||
public DateTime TimeLastAccessed { get; private set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this <see cref="T:Nibriboard.RippleSpace.Chunk"/> is primary chunk.
|
||||
/// Whether this <see cref="Chunk"/> is a primary chunk.
|
||||
/// Primary chunks are always loaded.
|
||||
/// </summary>
|
||||
[JsonProperty]
|
||||
|
|
Loading…
Reference in a new issue