Example #1
0
 public A04Client(string host, string password) {
   if(!Uri.TryCreate(host, UriKind.Absolute, out url)) {
     throw new ArgumentException("host");
   }
   _connEvnt = new List<WaitConnect>();
   _sio = new SioClient((url.Scheme == "x13s" ? "wss://" : "ws://") + url.DnsSafeHost + (url.IsDefaultPort ? string.Empty : (":" + url.Port.ToString())) + "/api/v04", ProcessMessage);
   root = new DTopic(this);
 }
Example #2
0
 private void ProcessMessage(SioClient.Event e, INotMsg msg) {
   switch(e) {
   case SioClient.Event.Connected:
     if(string.IsNullOrEmpty(url.UserInfo)) {
       _st = State.Ready;
       ReportConnectState(true, null);
     }
     break;
   case SioClient.Event.Disconnected:
     break;
   case SioClient.Event.Ack:
   case SioClient.Event.Error:
     if(msg != null) {
       DWorkspace.This.AddMsg(msg);
     }
     break;
   case SioClient.Event.Event: {
       var ev = msg as DTopic.Event;
       if(ev != null) {
         ev.client = this;
         DWorkspace.This.AddMsg(ev);
       }
     }
     break;
   }
 }