Tutorial question for Glitch.io

So in the tutorial project for multiplayer, it asks you to rewrite the whole script. Is it possible for me to just go into Network.js and change the URL from the tutorial server to my server?

Hi @Dylan_McDorman,

You will have to be able to write code on the server that suits your game. So you will have to setup a glitch server and write/upload the server script there.

Then you can use the glitch url on the Network.js script.

I have here, https://glitch.com/edit/#!/common-dull-pheasant, It just won’t say "Client connected in the project that I made to test it on.

Look at the URL that the tutorial provides: https://developer.playcanvas.com/en/tutorials/real-time-multiplayer/#setting-up-the-project

And compare it to the URL that you are trying to use.

You can see how different they are. Look for the correct glitch URL for use in your glitch project.

1 Like

Do you mean this one? Screenshot 2021-02-12 at 7.45.27 AM

Cuz i already have it in there, that’s the first thing i did

In which case you are in debugging land. You need to check whether the issue is the server or the client. Also, glitch servers tend to take a while to spin up from sleep so that may be causing an issue too.

When do they go to sleep? Because I have had it open for 30 mins now

And i know there’s now bugs because i just copied everything into my server from yall’s server. Minis the url and put mine in. and used the socket/network.js from the tutorial project. and I thought it would just be VOUALA…but no.

I’v been fiddling around but i still can’t get it to work. What do i do?

@Dylan_McDorman Are all the packages up to date, if so are you running on a node version of 11 or higher? Check this in package.json, if it is all up to date make sure to enable cors, you can easily do this by adding a option to your server:

/*previous:*/ var io = require('socket.io')(server);
/*after:*/ var io = require('socket.io')(server,{cors:true}/*Options Goes here*/);

Also if your server is asleep you can use up-time-robot to keep it active every 5 minutes.

1 Like