Пример #1
0
		public void websocketClient_Opened(object sender, EventArgs e)
		{
			_failing = false;
			Logger.Info("Websocket: Connection to API established.");
			if (Properties.Settings.Default.OAuthToken == null)
				Logger.Error("Oops! I am attempting to connect without an OAuth token. That's probably bad.");
			else
			{
				AuthQuery auth = new AuthQuery()
				{
					action = "authorization",
					bearer = Properties.Settings.Default.OAuthToken
				};
				SendAuth(auth);
				SubscribeStream("0xDEADBEEF");
				APIQuery login = new APIQuery
				{
					action = "rescues:read",
					data = new Dictionary<string, string> {{"open", "true"}}
				};
				SendQuery(login);
				Logger.Info("Sent RescueGrid Update request.");
			}
			//TODO: Put stream subscription messages here when Mecha goes live. Do we want to listen to ourselves?
		}
Пример #2
0
		public void SendAuth(AuthQuery myauth)
		{
			string json = JsonConvert.SerializeObject(myauth);
			Logger.Debug("Sent an API Auth message serialized as: " + json);
			Ws.Send(json);
		}