SocketCluster / SocketCluster/socketcluster

socketcluster compliance

Open
#595 3 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

I work with a server in version socketcluster-server@19.0.1 (why its not available on tags of repository).
And a client on version socketcluster-client@14.3.2

I have issue with following code :

node_modules/socketcluster-server/serversocket.js

`
// Receive incoming raw messages
this.socket.on('message', async (messageBuffer, isBinary) => {
let message = isBinary ? messageBuffer : messageBuffer.toString();
this.inboundReceivedMessageCount++;

let isPong = message === pongMessage;

`

problem is that isBinary function is not implemented on ws link to the version of the client socketcluster-client@14.3.2
Thats means when pong arrive isBinary is set to false
and we cannot validate the condition let isPong = message === pongMessage;

What to you think to change this code by :

node_modules/socketcluster-server/serversocket.js

`
// Receive incoming raw messages
this.socket.on('message', async (messageBuffer) => {
let message = Buffer.from(messageBuffer).toString();
this.inboundReceivedMessageCount++;

let isPong = message === pongMessage;

`
This will work on all case with and without isBinary.

or other option is to specify an option to keep the compliance with old client by running this code conditionnaly.

I know the best options is to update server and client, I will do this however this will be more easy to keep compliance during migration.

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 by locating the source corresponding to node_modules/socketcluster-server/serversocket.js and read the socket message handler alongside the supported client and ws versions. Verify how pong messages are delivered with and without the isBinary argument. Done means the server validates pong messages for socketcluster-client@14.3.2 while preserving compatibility with newer clients.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.