public void MakeRequest(RoomParametersFetcherCallback callback)
        {
            var httpConnection = new AsyncHttpURLConnection(MethodType.Post, _roomUrl, null, async(response, errorMessage) =>
            {
                if (errorMessage != null)
                {
                    callback?.Invoke(null, errorMessage);
                    return;
                }

                await RoomResponseParseAsync(response, callback);
            });

            httpConnection.Send();
        }
        private void SendWSSMessage(MethodType method, string message)
        {
            var postUrl = $"{_postServerUrl}/{_roomId}/{_clientId}";

            Logger.Debug(TAG, $"WS {method} : {postUrl} : {message}");

            var httpConnection = new AsyncHttpURLConnection(method, postUrl, message, (response, errorMessage) =>
            {
                if (errorMessage != null)
                {
                    ReportError($"WS {method} error: {errorMessage}");
                }
            });

            httpConnection.Send();
        }
Beispiel #3
0
        private void SendPostMessage(MessageType messageType, string url, string message)
        {
            var logInfo = url;

            if (message != null)
            {
                logInfo += $". Message: {message}";
            }

            _logger.Debug(TAG, $"C->GAE: {logInfo}");

            var httpConnection = new AsyncHttpURLConnection(MethodType.Post, url, message, ((response, errorMessage) =>
            {
                _executor.Execute(() =>
                {
                    if (errorMessage != null)
                    {
                        ReportError($"GAE POST error : {errorMessage}");
                        return;
                    }

                    if (messageType != MessageType.Message)
                    {
                        return;
                    }
                    try
                    {
                        var msg = JsonConvert.DeserializeObject <ARDMessageResponse>(response);
                        if (msg.Type != ARDMessageResultType.Success)
                        {
                            ReportError($"GAE POST error : {response}");
                        }
                    }
                    catch (JsonException e)
                    {
                        ReportError($"GAE POST JSON error: {e.Message}");
                    }
                });
            }));

            httpConnection.Send();
        }