Error when running needle networking server

Using the minimal fastify server code from and adding the two lines of code as instructed at which results in the following:

// Require the framework and instantiate itconst fastify = require('fastify')({ logger: true })const networking = require('@needle-tools/needle-tiny-networking-ws')networking.startServerFastify(fastify, {endpoint: "/socket"});// Declare a routefastify.get('/', async (request, reply) => {  return { hello: 'world' }})// Run the server!const start = async () => {  try {    await fastify.listen({ port: 3000 })  } catch (err) {    fastify.log.error(err)    process.exit(1)  }}start()```

This code runs and if I access https://localhost:3000 I get the {hello"world"} object as expected.

If I try to access https://localhost:3000/socket however the process terminates with the following error:

TypeError: is not a function
    at FastifyProxy.send (/Users/ideajuice/Documents/NTServer/node_modules/@needle-tools/needle-tiny-networking-ws/src/proxy.js:33:24)

When I run the server, it complains about fastify-websocket being deprecated:

(node:7425) [FST_MODULE_DEP_FASTIFY-WEBSOCKET] FastifyWarning.fastify-websocket: fastify-websocket has been deprecated. Use @fastify/websocket@5.0.0 instead.

I am creating this app as follows:

npm init
npm install typescript
npm install @types/node
npm install fastify
npm install fastify-websocket
npm install @needle-tools/needle-tiny-networking-ws

Do I need to install specific versions of fastify or fastify-websocket?

How should I test to see if the needle networking stuff is working via the /socket endpoint?

[Original Post on Discord](

*by user 563549194137239552*

Can you try installing fastify ^3.29.0 ?

will try iy… actually i will try just installing needle-tiny-netowkring and then let the dependencies install fastify

by user 563549194137239552

3.29.0 still gives a warning about fastify-websocket being deprecated, but it doesn’t exit the process when i acces the localhost:3000/socket url! so progress

by user 563549194137239552

trying to run the original project where i wanted to have a local server and am now getting this error:
Curl error 60: Cert verify failed: UNITYTLS_X509VERIFY_FLAG_USER_ERROR1

by user 563549194137239552

this is before I changed anything to use the local server

by user 563549194137239552

This error went away after restart as per your other post, right?

yes… thanks… i think i have a local server running and just trying to get it to work with the drag drop listener

by user 563549194137239552

it’s been a good day!

by user 563549194137239552

So things are mostly working but I am getting this error about creating files… SAVE GlitchTemplatewrong_giraffe_483
error saving room state GlitchTemplatewrong_giraffe_483 Error: ENOENT: no such file or directory, mkdir ‘.data/rooms’

by user 563549194137239552

Do i need to create this folder and change it’s permissions or something in order for it to work? The good news is my app is definitely connecting to and using my local server now

by user 563549194137239552

beyond that i am also getting an error about the local server certificate bein invalid because its self signed… that is when i try to use the drag drop componment

by user 563549194137239552

Can you post screenshots of the errors?

The first looks like, yes, you need to create the .data folder yourself for a local setup. On glitch that folder exists by default, so the code may not yet check for that.

Thanks @herbst🌵 - I created the folder and now there are no errors about creating files

by user 563549194137239552