/// <summary>
 /// The constructor.
 /// </summary>
 /// <param name="encoding">Encoding is used for encoding and decoding messages.</param>
 public MessageManager(Encoding encoding)
 {
     _encoding = encoding;
     _src      = new CancellationTokenSource();
     _state    = MessageManagerState.Initial;
     _buffer   = WebSocket.CreateServerBuffer(10000);
 }
 protected bool HandleChangeState(byte[] data)
 {
     if (ChangeStateMessage.TryDecode(data, _encoding, out ChangeStateMessage msg))
     {
         _state = msg.State;
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 3
0
 public ChangeStateMessage(MessageManagerState state = MessageManagerState.Initial)
 {
     State = state;
 }