Still in CONNECTING state
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.5k
- Forks
- 79
- PR merge metrics
- No merged PRs in 30d
Description
First time I've used sockets in a while...
I'm building a simple react voting example that allows a room of people to click as many times and as fast as they want on one of 6 choices and that will cast their vote.
This definitely seems like an issue with how fast everything can process each vote.
However, I'm not sure where to start?
This is the bulk of the code:
```
const onVote = vote => {
console.log({ vote, ws });
ws.json({
action: 'sendMessage',
data: JSON.stringify(vote)
});
};
const onMessageReceied = ({ data }) => {
console.log({ data });
const voteData = JSON.parse(data);
console.log({ onMessageReceied: voteData });
setBallotsList({ ...ballotsList, ...voteData });
};
useEffect(() => {
console.log({ ballotsList });
ws = new Sockette(config.site.api, {
timeout: 5e3,
maxAttempts: 1,
onopen: e => console.log('connected:', e),
onmessage: e => onMessageReceied(e),
onreconnect: e => console.log('Reconnecting...', e),
onmaximum: e => console.log('Stop Attempting!', e),
onclose: e => console.log('Closed!', e),
onerror: e => console.log('Error:', e)
});
return function cleanup() {
ws && ws.close();
ws = null;
};
}, [ballotsList]);
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The relevant entry point is the Sockette constructor and lifecycle callbacks shown in the useEffect; first reproduce the CONNECTING state with the supplied React example and inspect the open, error, and close logs. Done means identifying whether the behavior is in Sockette or the example and documenting a reproducible diagnosis.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100