Phoenix.Channel.Channel C# (CSharp) Méthode

Channel() public méthode

public Channel ( string topic, Newtonsoft.Json.Linq.JObject params_, Socket socket ) : Newtonsoft.Json.Linq
topic string
params_ Newtonsoft.Json.Linq.JObject
socket Socket
Résultat Newtonsoft.Json.Linq
    public Channel(string topic, JObject params_, Socket socket)
    {
      _state = ChannelState.Closed;
      _topic = topic;
      _params = params_ ?? Phoenix.EMPTY_JS_OBJECT;
      _socket = socket;

      _bindings = new List<Binding>();
      _timeout = _socket.Timeout;
      _joinedOnce = false;
      _joinPush = new Push(this, Phoenix.CHANNEL_EVENT_JOIN, _params, _timeout);
      _pushBuffer = new List<Push>();

      _rejoinTimer = new RetryTimer(RejoinUntilConnected, _socket.ReconnectAfterMs); //jfis - why another timer instead of waiting for socket event?

      _joinPush.Receive("ok",
        (_) =>
        {
          _socket.Log("JP REC OK", "");
          _state = ChannelState.Joined;
          _rejoinTimer.Reset();
          foreach (var p in _pushBuffer) p.Send();
          _pushBuffer.Clear();
        }
      );

      OnClose(() =>
        {
          _socket.Log("channel", $"close {_topic}");

          _state = ChannelState.Closed;
          _socket.Remove(this);
        });

      OnError(
        () => //reason only used for logging
        {
          _socket.Log("channel", $"error {_topic}"); //, reason);

          _state = ChannelState.Errored;
          _rejoinTimer.SetTimeout();
        }
      );

      _joinPush.Receive("timeout",
        (_) =>
        {
          if (_state == ChannelState.Joining) return;

          _socket.Log("channel", $"timeout {_topic}");//, _joinPush.timeout)

          _state = ChannelState.Errored;
          _rejoinTimer.SetTimeout();
        }
      );

      On(Phoenix.CHANNEL_EVENT_REPLY, OnReply);
    }
    private void OnReply(JObject payload, string ref_)