SocketCluster / SocketCluster/socketcluster

Messages sent multiple times

Open
#445 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
6.2k
Forks
318
PR merge metrics
No merged PRs in 30d

Description

Hello,

I have this code:

var mychannel = socket.subscribe("updates-" + payload[1] + "-" + payload[4]);
mychannel.on('subscribe', function(){
    mychannel.publish(dbmsg.payload, function(err, ackData){
        mychannel.unsubscribe();
        console.log("adjust: sent " + dbmsg.payload);
    });
});

The payload is a string like "UPDATE;;995502044;;1.65;;2.65;;276" that I split.

Whenever that code is triggered it sends some of the previous messages, for example if I try to send this payload "UPDATE;;995502044;;0.00;;15.00;;276" it logs this:

adjust: sent UPDATE;;995502044;;1.65;;2.65;;276
adjust: sent UPDATE;;995502044;;2.65;;3.65;;276
adjust: sent UPDATE;;995502044;;3.65;;4.65;;276
adjust: sent UPDATE;;995502044;;4.65;;0.00;;276
adjust: sent UPDATE;;995502044;;0.00;;15.00;;276 <---- the payload I just sent. all above are older.

It's basically re-sending the whole message history for some reason.

Am I doing something wrong?

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

Begin with the subscribe, subscribe callback, publish, and unsubscribe flow shown in the issue, reproducing it with the supplied payload sequence. Compare the repeated logging with SocketCluster's channel lifecycle and publish behavior; done means determining whether this is framework behavior or application misuse and documenting a minimal reproducible result.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.