It says "web socket" open but

Hi :slight_smile:

before I get into my question, here is a quick thank you video for all the help I am getting so far:

so… the error I am getting is shown below. I need the server connected no matter what ALL the time. Anything you can do to help would be appreciated.

2 Likes

Hi,
firstly, nice app!

Your error - it looks like you are using the wrong uplink key. Are you sure the uplink code connect key matches the one shown in in the IDE?

What’s the time difference between the “connection open” and the key error? I’ve not tried this yet, but do you get the same effect if you make the key in the uplink connect complete nonsense (eg “GGGGGGGGG”)? I’m wondering if the connection message happens anyway before the key is authed.

You may have to post a little more info if I have misunderstood.

Thanks,

Thanks for the reply david :slight_smile:

The link works very well for about 12 hours, but when I come back to the computer after being away it seems to be in this state. I was wondering if there is a time out or something?

Whatever the cause I need a find a fix so that the channel can rely on the controls 24/7

many thanks!!!

Michael

Is it a laptop?
Maybe a problem with some power saving/sleeping/relaxing going on?

My uplinks usually stay up for days or weeks without problems. They are also able to reconnect after the internet comes back up after Anvil unrelated connection problems.

Once in a while they can’t reconnect, maybe once a month, and I just reboot my dedicated-no-powersaving-no-laptop computer. I will eventually setup a nightly automatic reboot, but for now I’m happy.

1 Like

I can see why you would say that but no, they’re always always on.

here’s a video of when I caught it failing again:

Hi @michaellavers, thanks for letting us know about this, and for your video which shows the issue very clearly.

I notice in the video that your script has this line in it:

anvil.server.connect('<your uplink key here>')

That will cause the connection error you’ve reported - the '<your uplink key here>' needs to be replaced with a unique key for your app, provided by Anvil. The Uplink uses that key to identify which app it’s connecting to.

You can find the key in the Gear Menu:

Screen Shot 2020-02-17 at 15.43.35

You’ll get a dialog like this, you press a button marked ‘Enable uplink for this app’, and then the key is generated:

Screen Shot 2020-02-17 at 15.45.28

For this app, I would use

anvil.server.connect("Y3CDXDFSQAPJ3GXUSFE6U3B2-HOATI3WIZMRMQYQS")

in my Uplink script.

This doesn’t necessarily explain the intermittancy you’re seeing. I’m thinking you might have two anvil.server.connect lines in your script: one that contains the correct Uplink key, and one with '<your uplink key here>'. Is that correct?

1 Like

Oh man… THANK YOU guys so much! I can’t believe what a doofus I was to miss that and I really appreciate the time you took to help!

The server has been rock solid ever since!

1 Like

No problem, I’m glad it’s working! Out of interest, did you have two anvil.server.connect, or just one?

You were 100% right - had two in there!! Thanks again!

1 Like