Feathers: socket.io-client v 3.0.1 incompatible

Created on 16 Nov 2020  Â·  16Comments  Â·  Source: feathersjs/feathers

Ran into an issue with @feathersjs/socketio-client not working with the latest version of socket.io-client (3.0.1) It fails to establish the socket connection returning (bad handshake)

Steps to reproduce

create a new feathersjs application that uses socketio

install these packages in your frontend:
@feathersjs/[email protected]
@feathersjs/[email protected]
socket.[email protected]

in your frontend set up the socket connection following the code from the @featherjs/socketio-client documentation.

const feathers = require('@feathersjs/feathers');
const socketio = require('@feathersjs/socketio-client');
const io = require('socket.io-client');

const socket = io('http://api.feathersjs.com');
const app = feathers();

// Set up Socket.io client with the socket
app.configure(socketio(socket));

Expected behavior

Should successfully establish the connection.

Actual behavior

gets a (bad handshake) return, and then proceeds to try again repeatedly with no success.

If I downgrade socket.io-client to version 2.3.0 it works without an issue.
I am not sure if this is a bug with @feathersjs/socketio-client, socket.io-client v3.0.1 or if there is just some additional configuration necessary to get socket.io-client v3.0.1 working, in which case the documentation should probably be updated.

System configuration

Module versions (especially the part that's not working):
@feathersjs/feathers 4.5.10
@feathersjs/socketio-client 4.5.10
socket.io-client 3.0.1

NodeJS version:
12.18.0
Operating System:
Windows 10

Browser Version:
Chrome v86.0.4240.198

React Native Version:

Module Loader:

Breaking Change Transport

Most helpful comment

Due to the Pandemic, having lost most sponsors and with contributors needing to focus on their own lives and businesses first, there currently is no set release date. Sponsorships are always welcome and with two or three more companies or individuals at the gold or platinum tier I'd be willing to commit to a more fixed date.

All 16 comments

The socket.io library, client and server parts, has introduced breaking change in it's last major 3.0 update.
For now, we need to pin the socket.io dependencies to 2.x in order to avoid incompatibilities.

Correct. You can not upgrade your socket.io-client dependencies to version 3. Because of some pretty significant breaking changes this upgrade can not happen until Feathers v5.

what is the release date for Feathers v5 ?

Due to the Pandemic, having lost most sponsors and with contributors needing to focus on their own lives and businesses first, there currently is no set release date. Sponsorships are always welcome and with two or three more companies or individuals at the gold or platinum tier I'd be willing to commit to a more fixed date.

dumb question: currently you accept monthly contributions through github.
is there still an option for one-time donations like what was possible with
opencollective (or whatever it was called) ?

Thank you,

Mark Edwards

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon
Virus-free.
www.avast.com
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Fri, Nov 27, 2020 at 11:06 AM David Luecke notifications@github.com
wrote:

Due to the Pandemic, having lost most sponsors and with contributors
needing to focus on their own lives and businesses first, there currently
is no set release date. Sponsorships are always welcome
https://github.com/sponsors/daffl and with two or three more companies
or individuals at the gold or platinum tier I'd be willing to commit to a
more fixed date.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/feathersjs/feathers/issues/2128#issuecomment-734955742,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAWJ3YSU3WA7C5DYCOMOCTTSR72BZANCNFSM4TWQN2AQ
.

I don't think GitHub currently supports that (although it looks like you can set a custom amount higher than the tier you selected). The best way right now is probably to sponsor and then cancel right away. Personally I'd rather have a (possibly lower but more predictable) monthly income stream so it's a little easier to make longer term plans. Like I already mentioned in Slack, current sponsorships help to keep things maintained and moving forward but it's unfortunately not enough to justify the time investment necessary to commit to specific release dates.

Am I currently gold or platinum? Maybe a new higher category called Dilithium?

On November 27, 2020, at 11:39 AM, David Luecke notifications@github.com wrote:

I don't think GitHub currently supports that (although it looks like you can set a custom amount higher than the tier you selected). The best way right now is probably to sponsor and then cancel right away. Personally I'd rather have a (possibly lower but more predictable) monthly income stream so it's a little easier to make longer term plans. Like I already mentioned in Slack, current sponsorships help to keep things maintained and moving forward but it's unfortunately not enough to justify the time investment necessary to commit to specific release dates.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.

[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/feathersjs/feathers/issues/2128#issuecomment-734963609", "url": "https://github.com/feathersjs/feathers/issues/2128#issuecomment-734963609", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

This has been done in v5.0.0-pre.1 and is now in beta testing. Latest prereleases can be installed via @feathersjs/<packagename>@pre, updating the version numbers of all @feathersjs packages to ^5.0.0-pre.1 or by running

npx ncu -u --newest

Upgrade instructions are continuously updated and can be found in the v5 migration guide.

The final version will probably have a way to also supply a previous version Socket.io server.

Little error ?
Module not found: Error: Can't resolve '@feathersjs/transport-commons/src/client' in '/node_modules/@feathersjs/socketio-client/lib'

Two days ago there was a socket.io update with a major security change that broke all my apps. More info can be found here https://socket.io/blog/socket-io-2-4-0/
My workaround was to install on my server npm install [email protected] --save. However, that is not the most recommended solution. Any ideas on how to address this?
https://github.com/socketio/socket.io/releases/tag/2.4.0

The release notes you linked seem to be pretty specific on how to address the upgrade no? How to configure @feathersjs/socketio is shown in the API docs.

As explained in the blog post, now we need to explicitly configure the origins on the server side.

Ugh but I get what you mean, sneaky buggers, your stuff will literally just stop working even if you just reinstall with no warning or anything. 😞

@tonhozi Thanks so much. Your workaround helped me a lot!
Hope we can get latst 2.4.0 support for Feathers!
By the way a pretty hard problem, you dont get any logs at all about this.

@tonhozi Thanks for posting this. I spent hours trying to figure out why all my API calls suddenly failed. No warning, no nothing.

Until @daffl's https://github.com/feathersjs/feathers/pull/2185 is merged, here's a manual workaround:

app.configure(
  socketio(function (io) {
    io.origins((_, callback) => {
      callback(null, true);
    });
  })
);

The change has also just been reverted so if you are running into issues make sure to reinstall all dependencies and that npm ls socket.io show version 2.4.1 or later.

Was this page helpful?
0 / 5 - 0 ratings