예제 #1
0
        public WebSocket(PushBulletClient client, PushBulletClientConfig config, JsonSerializer serializer)
        {
            _socket = new CasinoSocket();
            _socket.MessageReceived += MessageReceived;

            _client     = client;
            _config     = config;
            _serializer = serializer;
        }
예제 #2
0
        public RequestClient(PushBulletClient client, PushBulletClientConfig config, JsonSerializer serializer)
        {
            _client = client;

            _http = new HttpClient
            {
                BaseAddress = new Uri(config.ApiBaseUrl)
            };

            _http.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            _http.DefaultRequestHeaders.Add("Access-Token", config.Token);

            _serializer = serializer;
            _semaphore  = new SemaphoreSlim(1, 1);
        }