mirror of
https://github.com/Dadechin/Unity-WebSocket.git
synced 2025-07-03 20:04:33 +00:00
39 lines
1.4 KiB
C#
39 lines
1.4 KiB
C#
|
|
using System;
|
|
using UnityEngine;
|
|
|
|
namespace FishNet.Managing.Transporting
|
|
{
|
|
|
|
/// <summary>
|
|
/// When inherited from this may be used with the TransportManager to alter messages before they are sent and received.
|
|
/// </summary>
|
|
public abstract class IntermediateLayer : MonoBehaviour
|
|
{
|
|
/// <summary>
|
|
/// TransportManager associated with this script.
|
|
/// </summary>
|
|
public TransportManager TransportManager { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Called when data is received.
|
|
/// </summary>
|
|
/// <param name="src">Original data.</param>
|
|
/// <param name="fromServer">True if receiving from the server, false if from a client.</param>
|
|
/// <returns>Modified data.</returns>
|
|
public abstract ArraySegment<byte> HandleIncoming(ArraySegment<byte> src, bool fromServer);
|
|
/// <summary>
|
|
/// Called when data is sent.
|
|
/// </summary>
|
|
/// <param name="src">Original data.</param>
|
|
/// <param name="toServer">True if sending to the server, false if to a client.</param>
|
|
/// <returns>Modified data.</returns>
|
|
public abstract ArraySegment<byte> HandleOutgoing(ArraySegment<byte> src, bool toServer);
|
|
|
|
/// <summary>
|
|
/// Initializes this IntermediateLayer for use.
|
|
/// </summary>
|
|
public virtual void InitializeOnce(TransportManager manager) => TransportManager = manager;
|
|
}
|
|
|
|
} |