using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
public class WebSocket
{
public enum State
{
PluginError = -1,
Connecting = 0,
Open = 1,
Closing = 2,
Closed = 3
}
private static class WebSocketInternals
{
[DllImport("__Internal")]
public static extern int Constructor(string url);
[DllImport("__Internal")]
public static extern int ReadyState(int socketId);
public enum PollEventType
{
None = 0,
Close = 1,
Error = 2,
Message = 3,
Open = 4
}
}
private int socketId;
public WebSocket(string url)
{
socketId = WebSocketInternals.Constructor(url);
}
public State ReadyState
{
get
{
return (State)WebSocketInternals.ReadyState(socketId);
}
}
}