This forum has moved, please join us on github discussions. We will keep these old posts available for reference. Thank you!

Apostrophe-websockets not working

Hi i’m new to apostrophe cms and i try to implement apostrophe-websockets recently. But it shows error. can anyone help me out.

Error is

if (key.substr(0, 2) === '__') {
              ^
TypeError: key.substr is not a function

Thank you.

Hi,

The apostrophe-websockets module is a legacy module for Apostrophe 0.5.x. It will not work as-is with 2.x.

I’m working on getting the npm publication rights so I can update the docs to say so, and/or just add a 2.x implementation, which probably wouldn’t be difficult. I’d tweak a few things (“adminOnly” is a misleading name for something that is visible to all logged in users, for instance) but generally speaking the module’s design could still be a good fit.

(There is nothing preventing you from creating your own module in your project in which you require socket.io, and push its frontend javascript library as an asset. But it would be nice to package that again.)

Ohh, Thank you for your replay. I’m working on that now.