Sandbox Logo

About Websocket Tools

This library is designed to help simplify the process of interacting with Websockets. 
You are able to serialize text into a json or send a string.

Source: https://github.com/Nolankicks/sbox-websocket-tools

API

public class WebsocketTools

{
//The websocket URL
string url;
//Where you want to fetch from the websocket, not used in Send()
public enum Fetch
{
OnUpdate,
OnFixedUpdate,
OnStart,
}
//An action called when a message is recived from the websocket
public delegate void OnMessageReceived( string message );
//A game resource that holds Json or string data to be send to the Websocket
public WebsocketMessage message;
}

public class WebSocketUtility
{
//Sends a message over a websocket connection
public static async Task SendAsync( WebsocketTools websocketTools );
//Sends a string over a websocket connection
public static async Task SendStringAsync( string url, string message )
}