コード例 #1
0
        public async Task BroadcastMessageAsync(OicMessage request)
        {
            var message = request.ToCoapMessage();

            message.IsMulticast = true;
            message.Type        = CoapMessageType.NonConfirmable;

            await _client.SendAsync(message);
        }
コード例 #2
0
        public async Task <int> SendMessageAsync(OicMessage request, IOicEndpoint endpoint = null)
        {
            var coapEndpoint = endpoint as OicCoapEndpoint
                               ?? throw new ArgumentException($"{nameof(endpoint)} is not of type {nameof(OicCoapEndpoint)}", nameof(endpoint));

            var message = request.ToCoapMessage();

            var baseRequest = message.Clone();

            baseRequest.Payload = null;
            _requestMessages.Add(request.RequestId, baseRequest);


            return((await _client.SendAsync(message, coapEndpoint._coapEndpoint)).Id);
        }