Esempio n. 1
0
 private async Task SetupClient()
 {
     if (ClientId == null)
     {
         LogEvent("Creating a new client.");
         var payload = new PayloadClientCreate()
         {
             Client = new SpeckleClient()
             {
                 StreamId = StreamId, Role = Role.ToString(), Online = true
             }
         };
         ClientId = (await this.ClientCreateAsync(payload)).ClientId;
     }
     else
     {
         LogEvent("Setting client to alive.");
         var payload = new PayloadClientUpdate()
         {
             Client = new SpeckleClient()
             {
                 Online = true
             }
         };
         this.ClientUpdate(payload, ClientId);
     }
 }
Esempio n. 2
0
        public void Dispose()
        {
            IsDisposed = true;
            var payload = new PayloadClientUpdate()
            {
                Client = new SpeckleClient()
                {
                    Online = false
                }
            };

            try { ClientUpdateAsync(payload, ClientId); } catch { }
            try { WebsocketClient.Close(); } catch { }
        }
        public void Dispose(bool delete = false)
        {
            IsDisposed = true;

            if (!delete)
            {
                var payload = new PayloadClientUpdate()
                {
                    Client = new SpeckleClient()
                    {
                        Online = false
                    }
                };
                ClientUpdateAsync(payload, ClientId);
                WebsocketClient?.Close();
                return;
            }

            this.ClientDeleteAsync(ClientId);
            WebsocketClient?.Close();
        }