I can't access simple node.js server, but I could before

javascript

#1

Hi. I managed to create a simple node.js server and connect to it from other websites. Then, I deleted index.html file with client.js and readme.md, leaving the rest. The first problem I saw was ‘Upgrade Required’ text on my site, even after recreating index.html file. So I tested if I could still connect to my server, and… no, I couldn’t. After some time, I’m getting ‘connection_timed_out’ error in the console of the website i tried to connect to my server from. What am I missing?


#2

Can you try rewinding the project to back before you removed those files, and see if that works?

The rewind option is beside the tools section in the bottom left, it is represented by two left facing arrows!


#3

Hey @supahero, welcome to the Glitch forum!

@Callum-OKane’s suggestion is a good one for getting back into a working state. This behavior sounds odd and unexpected to me though; I’d be happy to take a closer look if you care to share your project name.


#4

I have done exactly what you said. I used the rewind tool, but I noticed that website isn’t back! There is still ‘Upgrade Required’ error. I also still can’t connect to my server! I am at the last possible checkpoint before my server file having different code, and I clearly remember it worked just fine! I was able to connect to it, even receive a message! I think this all is because the ‘Upgreade Required’ thing. Anyway, what is that?


#5

Sure I don’t mind showing my code! My project name is sour-calf-1! It’s currently rewinded back as callumok2004 suggested.


#6

Maybe something that you are using for this needs an update, just as it says?


#7

Only thing that my code would need to have updated is node modules, but they shouldn’t cause problems with older version, at least I think so! I tried to upgrade a module I’m using, ws. No changes! I only have one .ico file stored in assets, I can’t think of anything that needs to be updated!


#8

I am in the project now, Can I have edit permissions so I can maybe see what is going on?


#9

You have ones! Go on!


#10

Hey @supahero I think you’re seeing the problem described in https://github.com/websockets/ws/issues/1297. Basically, you’re setting things up to use websockets (ws), but when you load the project’s web page you’re sending a normal HTTP request. ws is telling you (admittedly in a not-very-user-friendly way) that if you want to talk to it you need to “upgrade” your request to a websocket request.

I’m pretty sure that explains what you’re seeing. What the proper fix is depends on what you’re trying to accomplish. If you can describe that for us (maybe in a new topic, since it’s not really related to the error you had at first) I imagine someone can offer some help there.


Bindings error on node.js