share / share/sharedb

Document connection.close and connection.bindToSocket

Open
#306 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
6.5k
Forks
456
Avg merge
1d 5h
Merged PRs (30d)
5

Description

I learned from @houshuang that it's possible to manage reconnection as follows:

window.disconnect = function() {
  connection.close();
};
window.connect = function() {
  var socket = new WebSocket('ws://' + window.location.host);
  connection.bindToSocket(socket);
};

Context https://github.com/houshuang/presence-demo/blob/master/client.js#L55

I find this feature quite useful for managing reconnections. It would be great to document it.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reconnection example in client.js around line 55 and inspect how connection.close and connection.bindToSocket are exposed. Update the relevant API documentation to explain this disconnect/reconnect flow, including the WebSocket example, and consider the work done when both methods and their use for reconnection are clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.