Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

StartServer listen failed error with UNET and WebGL

Discussion in 'UNet' started by Bungalow-12, Apr 29, 2016.

  1. Bungalow-12

    Bungalow-12

    Joined:
    Dec 10, 2013
    Posts:
    13
    Hi everybody! I'm using Unity 5.3.4f1 and UNET to add networking to a WebGL game. I plan to eventually build my own matchmaking server so I'm not using the one supplied by Unity.
    The problem is I have my NetworkManager object setup to listen using WebSockets.
    When the game loads up in WebGL I try to Start a Server using NetworkManager.singleton.StartServer() I get the error message in the browser's debug console that "StartServer listen failed."
    Can you not use WebSockets without Unity's matchmaker?
    Does this have to be loaded from an external internet address hosted address? (So NOT on LAN or localhost?)
    Does UNET NetworkManager not actually support WebSockets? Is there a Unity package I need to add that I am missing? Any help to get me going would really help.

    Thanks!
     
  2. Bungalow-12

    Bungalow-12

    Joined:
    Dec 10, 2013
    Posts:
    13
    Ok so I realize this was a dumb a question...You can't host the server via WebGL. So how do I host the Server Application?
    Even if I build an OSX application using web sockets I cannot connect to it via another OSX application. It works fine if Web Sockets are not being used. If it was just WebGL unable to connect I'd figure I was doing something minorly wrong. So everywhere I look it claims just check the box and it works using Web Sockets! :( Please help me understand this.
     
  3. S4ADO

    S4ADO

    Joined:
    Dec 9, 2015
    Posts:
    3
    Bump, having the same problem. Any solutions?
     
  4. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    You can run standalone application which will work as a host for web browser clients. I understand that it will require additional logic to have implemented
     
  5. S4ADO

    S4ADO

    Joined:
    Dec 9, 2015
    Posts:
    3
    Well, yes, the standalone application works fine. The problem is that your documentation says that once webscokets have been enabled, WebGL should also work fine. Any update on this?
     
  6. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    As far as i remeber, your standalone client should work like connection hub and clients should connect to them via web sockets. So, in spite that some of web browser client will serve as server of the game you still need to host some sort of server which will keep web socket connections to each client.

    Good news we are going to implement web socket packet relaying soon, probably it will solve your problem. Another possibility is to use web rtc, but we are still unsure are we going support them or not.

    Does my answer make sense?
     
  7. JakeOfSpades

    JakeOfSpades

    Joined:
    Aug 22, 2015
    Posts:
    44
    Hey aabramychev, so from what I understand you would have a standalone application (.exe) running on the server to host the games then clients via their browser with WebGL would connect as clients?
     
  8. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574