Search Unity

Websocket handling

Discussion in 'Multiplayer' started by Soaryn, Dec 13, 2018.

  1. Soaryn

    Soaryn

    Joined:
    Apr 17, 2015
    Posts:
    328
    When going for low latency, and accurate syncing between games, usually websockets have a hit and miss utilization; however, in my case I am looking to use Unity to passively receive updates via a websocket from an external 3rd party. The utilization of a websocket is not for me to change unfortunately as that is the tech requirement on the 3rd party side.

    My question: How difficult, and what would be entailed, to use this new "job-ified" method (The new Unity network package) for connecting, pinging, and receiving messages via a websocket connection? Is there something already present, or would we need to build the boiler plate for it?

    Assume the address I need to connect to is wss based. Currently, I am working on utilizing the new ECS system to drive all other components of the application; however, up until now I have been using WebSocketSharp to handle receiving events and I have noticed a few hiccups when it comes to communicating between a jobified environment and a typcial C# thread system. While the two can exist together, I'd prefer to push everything towards a Unity solution before using 3rd party DLLs to sort out websocket connections efficiently.