// 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: this.ws.socket.send 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](https://discord.com/channels/717429793926283276/1106958134431457294)
*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
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
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’
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
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
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.