private async void OnWebSocketMessageAsync(SDKBehavior behavior, MessageEventArgs e)
 {
     ArraySegment <byte> data = new ArraySegment <byte>(e.RawData);
     await Task.Run(() =>
     {
         this.OnReceiveData?.Invoke(behavior.Guid, data, data.Count);
     });
 }
        private async void OnWebSocketOpenAsync(SDKBehavior behavior)
        {
            var guid = Guid.NewGuid().ToString();
            WebSocketSharpClient client = new WebSocketSharpClient(behavior, guid);

            client.OnCloseAsyncNotifyServer = new Action <string, bool>(this.RemoveClientAsync);
            lock (this.ClientContainer)
            {
                this.ClientContainer.Add(guid, client);
            }
            await Task.Run(() =>
            {
                this.OnConnect?.Invoke(guid);
            });
        }
 internal WebSocketSharpClient(SDKBehavior behavior, string guid)
 {
     this.behavior      = behavior;
     this.behavior.Guid = guid;
     this.Guid          = guid;
 }
 private void OnWebSocketError(SDKBehavior behavior, ErrorEventArgs e)
 {
     this.RemoveClientAsync(behavior.Guid, false);
 }
 private void OnWebSocketClose(SDKBehavior behavior, CloseEventArgs e)
 {
     this.RemoveClientAsync(behavior.Guid, false);
 }