How do I keep a server connected?

0 favourites
  • 8 posts
From the Asset Store
The official Scirra Multiplayer Signalling Server for helping peers find and connect to each other
  • I'm working on something that requires a dedicated server, using the Multiplayer plugin for Construct. Using the Multiplayer Chat example, I'm launching it from an off site linux machine. Everything works fine, it launches as host, I can connect to it from my PC as a peer.

    Problem is, after x amount of hours the server just disconnects. I've trying having the server post in the chat every 10 minutes to show it's still active, it still happens.

    With how the MP Plugin works, if I just simply reconnect the server will no longer be the host.

    1. Is there something I am missing here that is causing the host to disconnect after so many hours?

    2. Is it the Construct signalling server that is the issue? Does it have a time limit on how long connections are active?

    3. Is there a better solution than the official Multiplayer Plugin?

    Thanks as always.

  • One workaround for the "server might reconnect as peer instead of host" would be to have the server build of your game be unique, in that it indeed will only accept being host in your events (if it's peer, disconnect). And your build for players has same system but in reverse, if a player becomes host, instantly disconnect themselves.

    Not the most ideal if a game was popping off with players, might struggle to get server to connect at right time.

  • That's exactly how I am building it. The problem is, once the server disconnects randomly, another peer becomes the host I believe. So when I try to reconnect to that room as the host it can't.

    I'll test this theory out though. However, just disconnecting at all is going to cause game issues as the server will constantly be doing something game related. So even a quick hiccup of disconnect, reconnect will cause issues.

    I'd like to figure out why its disconnecting at all. Thanks.

  • So I was testing this on an Ubuntu server using Firefox. I tested it again on a Windows PC using Chrome and it stayed connected for 5 days so far. Maybe it's a firefox issue?

  • Ohh interesting. I generally have the opinion to "stick to Chrome" for anything web based. I use Firefox as a main browser for day to day stuff, but always run web games and such in chrome.

    Good to know it lasted for many days!!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • For the users, don't auto join rooms or allow them to join/create a room that doesn't already exist. You can get the number of users in a room with Multiplayer.ListRoomPeerCount(index) expression

  • Sure, but how does that help the server from disconnecting randomly?

  • I was addressing

    The problem is, once the server disconnects randomly, another peer becomes the host I believe. So when I try to reconnect to that room as the host it can't.

    Peers don't automatically become hosts in an existing rooms if the host disconnects, unless you have them do so.

    There are a million possible reasons you could lose connection over long periods of time, and not all of them are under your control. Best way to proceed is to plan how to manage if and when it does happen.

    Since you also mentioned you did some testing with different browsers, if it's consistently reproducible, submit a bug report. And use the workaround you've discovered in the meantime, if you suspect that it will make a difference.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)