Try µWebSockets support in the Meteor. Pure speed, no memory leaks

@nwabdou85 what version of the Meteor you are using?

Can you provide the content of .meteor/packages and .meteor/versions files?

Also, can you provide the link to repository with project code?

@mrauhu, thank’s for relpy;

packages https://paste.ofcode.org/a3niKjZrUXyMxjsDAcbKpA
verions https://paste.ofcode.org/pbPdCKACMesU5VNbWMNVnp

I ve the respository locally , sorry;

I don’t see the socket-stream-client@0.2.1 and stream-server-uws in .meteor/versions.

Did you followed the guide?

Can you create a small public repository only for reproduction of the error?

Without it I can’t help you.

Did anyone ever use this in production successfully? Notice a performance improvement? Working on Meteor 1.8 - 1.10?

@evolross

I use it in production for Meteor 1.6.

Less CPU and memory usage.

You can try it using the guide.

1 Like

I’m on Meteor 1.9.3. Following the guide at meteor add socket-stream-client@=0.2.1 I get

=> Errors while adding packages:             
                                              
While selecting package versions:
error: No version of socket-stream-client satisfies all constraints: @=0.2.1, @~0.2.2
Constraints on package "socket-stream-client":
* socket-stream-client@=0.2.1 <- top level
* socket-stream-client@~0.2.2 <- top level
* socket-stream-client@0.2.0 <- ddp-client 2.3.3 <- ddp 1.4.0

Also, in reading the guide I see this replaces sock.js with WebSockets. What happens in clients that don’t support WebSockets and then can’t access sock.js?

@evolross

meteor add socket-stream-client@=0.2.1

In previous Meteor versions, this command pinned the package version of socket-stream-client, for using it with WebSocket only.

I rechecked on Meteor 1.10 and got the same error, but with different version @~0.2.3.

Also, I check the next step and found a conflict with the uws package that built for Node.js 8, and Meteor >= 1.9 that bundled with Node.js 12.

Until the conflict is fixed, the stream-server-uws package will not work with the Meteor version 1.9 and higher.

They won’t work.

https://caniuse.com/websockets

As March 2020 WebSockets global usage is 97.42%.

2 Likes

@evolross I fixed the conflict, stream-server-uws now works with latest Meteor versions.

Also updated the pull request.

4 Likes

@mrauhu I wanted to try uwebsockets, unfortunately I get this error after starting Meteor. I use Meteor 1.10.1

W20200410-21:41:39.873(2)? (STDERR) ReferenceError: **Tinytest is not defined**
W20200410-21:41:39.875(2)? (STDERR)     at module (socket-stream-client/client-tests.js:4:1)
W20200410-21:41:39.876(2)? (STDERR)     at fileEvaluate (packages\modules-runtime.js:336:7)
W20200410-21:41:39.877(2)? (STDERR)     at Module.require (packages\modules-runtime.js:238:14)
W20200410-21:41:39.878(2)? (STDERR)     at Module.profileWrapper [as require] (C:\Projects\lolvvv\WebApp\.meteor\local\build\programs\server\profile.js:254:16)
W20200410-21:41:39.878(2)? (STDERR)     at require (packages\modules-runtime.js:258:21)
W20200410-21:41:39.879(2)? (STDERR)     at C:\Projects\lolvvv\WebApp\.meteor\local\build\programs\server\app\app.js:55636:1
W20200410-21:41:39.879(2)? (STDERR)     at profileWrapper (C:\Projects\lolvvv\WebApp\.meteor\local\build\programs\server\profile.js:254:16)
W20200410-21:41:39.884(2)? (STDERR)     at C:\Projects\lolvvv\WebApp\.meteor\local\build\programs\server\boot.js:398:38
W20200410-21:41:39.885(2)? (STDERR)     at Array.forEach (<anonymous>)
W20200410-21:41:39.886(2)? (STDERR)     at C:\Projects\lolvvv\WebApp\.meteor\local\build\programs\server\boot.js:226:21
W20200410-21:41:39.887(2)? (STDERR)     at profileWrapper (C:\Projects\lolvvv\WebApp\.meteor\local\build\programs\server\profile.js:254:16)
W20200410-21:41:39.888(2)? (STDERR)     at C:\Projects\lolvvv\WebApp\.meteor\local\build\programs\server\boot.js:461:7
W20200410-21:41:39.889(2)? (STDERR)     at profileWrapper (C:\Projects\lolvvv\WebApp\.meteor\local\build\programs\server\profile.js:254:16)
W20200410-21:41:39.889(2)? (STDERR)     at time (C:\Projects\lolvvv\WebApp\.meteor\local\build\programs\server\profile.js:273:30)
W20200410-21:41:39.890(2)? (STDERR)     at Function.run (C:\Projects\lolvvv\WebApp\.meteor\local\build\programs\server\profile.js:295:14)
W20200410-21:41:39.891(2)? (STDERR)     at C:\Projects\lolvvv\WebApp\.meteor\local\build\programs\server\boot.js:460:13

Any ideas?

Best regards

HK

Thanks for reporting @hk86

First I’m thought it’s offtopic.

But after reproduction, I found misspell in my guide.

1 Like

This did not fix my issue. Event if I remove all the test code from client-tests.js the next error I get is:

W20200411-12:46:45.950(2)? (STDERR) TypeError: Package.describe is not a function
W20200411-12:46:45.951(2)? (STDERR)     at module (socket-stream-client/package.js:1:1)

Looks like some global dependencies are not known?

I reinstalled meteor choco install meteor
I resetted my app meteor reset
I cleared my node_modules folder and ran meteor npm install

1 Like

@hk86 run in your project folder:

  1. Remove ./socket-stream-client:
git submodule deinit socket-stream-client
git rm -f socket-stream-client
  1. Add ./packages/socket-stream-client:
git submodule add https://github.com/mrauhu/socket-stream-client packages/socket-stream-client
  1. Run your app:
meteor
1 Like

Now it works. Thank you!

1 Like