public void Dispose()
 {
     Log = new List <BwsMessage>();
     BwsJsInterop.WsRemove(_id);
     IsDisposed = true;
     GC.SuppressFinalize(this);
 }
 public void send(string Par_Message)
 {
     if (!string.IsNullOrEmpty(Par_Message))
     {
         BwsJsInterop.WsSend(_id, Par_Message);
         Log.Add(new BwsMessage {
             ID = Log.Count + 1, Date = DateTime.Now, Message = Par_Message, MessageType = BwsMessageType.send
         });
     }
 }
예제 #3
0
        public WebSocketHelper(string Par_URL, BwsTransportType Par_TransportType, IJSRuntime jsRuntime)
        {
            _JSRuntime = jsRuntime ??
                         throw new ArgumentNullException($"{nameof(jsRuntime)} missing. Try injecting it in your component, then passing it from OnAfterRender.");



            bwsJsInterop = new BwsJsInterop(_JSRuntime);

            _initialize(Par_URL, Par_TransportType);
        }
 private void _connect()
 {
     BwsJsInterop.WsAdd(_id, _url, new DotNetObjectRef(this));
 }
        public async Task <string> get_WsStatus()
        {
            short a = await BwsJsInterop.WsGetStatus(_id);

            return(BwsFunctions.ConvertStatus(a).ToString());
        }
 public void Close()
 {
     Log = new List <BwsMessage>();
     BwsJsInterop.WsClose(_id);
 }