Answers for "unity socket io"

C#
1

unity socket io

// Use this library, it works perfectly:
// https://github.com/dp0ch/Unity-SocketIO-Client

// Usage:
using Dpoch.SocketIO;

public class MyClass : MonoBehavior {
  public void Start {
    var socket = new SocketIO("ws://127.0.0.1:80/socket.io/?EIO=4&transport=websocket");

    socket.OnOpen += () => {
      Debug.Log("Connected!")
    };
    socket.OnConnectFailed += () => {
      Debug.Log("Connection failed.")
    };
    socket.OnClose += () => {
      Debug.Log("Connection closed.")
    };
    socket.OnError += (err) => {
      Debug.Log("Error: " + err)
    };

    socket.Connect();
  }
}

// Look into the libararies README for further documentation.
Posted by: Guest on September-07-2020

C# Answers by Framework

Browse Popular Code Answers by Language