Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cWS instead of uWS #567

Closed
1 task done
ghost opened this issue Dec 30, 2018 · 8 comments
Closed
1 task done

cWS instead of uWS #567

ghost opened this issue Dec 30, 2018 · 8 comments
Labels
question Further information is requested

Comments

@ghost
Copy link

ghost commented Dec 30, 2018

You want to:

  • request a feature

info

Does engine.io should support cWS instead of uWS websocket module?

uWS is dead and cWS is the most mature successor and uses uWebsocket under the hood too.

I've tried to implement it by myself in server.js of engine.io adding simply new case in switch statement:

switch (this.wsEngine) {
    case 'ws': wsModule = require('ws'); break;
    case 'uws': wsModule = require('uws'); break;
    case 'cws':
      wsModule = require('@clusterws/cws');
      wsModule.Server = wsModule.WebSocketServer;
    break;
    default: throw new Error('unknown wsEngine');
  }

It seems to not working at all, but it states compatibility with ws module.

cWS github project: https://github.com/ClusterWS/cWS

@darrachequesne
Copy link
Member

Hi! I haven't had the time to check the cws module yet, but that looks promising. Are you able to connect with the client?

@ghost
Copy link
Author

ghost commented Jan 2, 2019

Unfortunatelly not, I've discovered that there are some incompatibilites with original ws module, like handleUpgrade has different arguments, 2 instead of 4, the main important one was callback param, I've done some changes to this method and it works but then another problem occured so I gave up for a while.

Wonder if it's even possible to support it in engine.io without big changes

@ghost
Copy link
Author

ghost commented Jan 3, 2019

@darrachequesne

So far so good, I've upgraded "handleUpgrade" method to be compatible with ws module and also changed default EventEmitter like here: https://github.com/ClusterWS/cWS#replace-eventemitter
to classic one from 'events' module and it works! Gonna test it more

@yambakshi
Copy link

Whats the recommended uws workaround? Will it be removed from the wsEngine switch in server.js? (line 107)
It still throws an exception
Module not found: Error: Can't resolve 'uws'

@ghost
Copy link
Author

ghost commented Feb 27, 2019

@yambakshi, it is because you need to install uws first from npm (watch out for versions, read about uws author and why he had deleted it from npm)

@klimashkin
Copy link

klimashkin commented Mar 16, 2019

read about uws author and why he had deleted it from npm

@Kamil93 What do you mean? Could you elaborate more on where to read?

@mmdevries
Copy link

@klimashkin, I'm not sure if this solves your issue but we have created a new package based on the original uws merged with some fixes from cws. The new package should be compatible with node 10 and 12.
https://github.com/mmdevries/uws

@darrachequesne
Copy link
Member

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants