josephg / josephg/ShareJS

Doc.Close(), closes all the future sharejs.open() calls.

Open
#73 3 comments 0 reactions 0 assignees View on GitHub
implement me
Dominant language
JavaScript
Stars
5k
Forks
454
PR merge metrics
No merged PRs in 30d

Description

If you write:

sharejs.open("blah","text", function(err, doc)) {
// This connection works, and we can do what we need to.. Then later when deleting the control we use
doc.close();
}

sharejs.open("adifferentblah","text", function(err, doc)) {
if (err) { console.log(err); }
}

You will get a error about the connection being closed. And no futher connections are available.

Since I haven't had time to work in coffeescript, I'll tell you have I fixed the client side share.js file... :)

I worked around this by moving everything in the "Connection" function to a new function prototype called "reopen(host)" and then just calling reopen(host) as the only call in the main constructor.

Then I added these four lines (to reset the entire state to the reopen function:
this.lastError = undefined;
this.id = undefined;
this.lastReceivedDoc = undefined;
this.lastSentDoc = undefined;
and then in the Connection.Open I changed the 'stopped' error to
if (this.state === 'stopped') {
this.reOpen(this.host);
}

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.