I am attempting to send a socket message to a potentially connected client from the $connect route. I successfully retrieve the connection id from dynamodb. Whenever I attempt to send anything at all, I get the error:
No method found matching route %40connections/aM50DdTXCYcCGEA%3D for http method POST
The code I'm using to send:
Amazon.Runtime.AWSCredentials cd = new Amazon.Runtime.BasicAWSCredentials("*******", "******");
var domainName = request.RequestContext.DomainName;
var endpoint = $"https://{domainName}/{stage}";
context.Logger.LogLine($"API Gateway management endpoint: {endpoint}");
apiClient = new AmazonApiGatewayManagementApiClient(cd,
new AmazonApiGatewayManagementApiConfig
{
ServiceURL = endpoint,
RegionEndpoint = Amazon.RegionEndpoint.USEast2
});
Message testMessage = new Message()
{
AppId = "TestApp",
CommandData = "Testing"
};
MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(testMessage)));
PostToConnectionResponse response = await apiClient.PostToConnectionAsync(new PostToConnectionRequest()
{
ConnectionId = Uri.EscapeUriString(existing.ConnectionId),
Data = stream
});
I can't seem to find anything that suggests why the endpoint for POST isn't working (I have a working sample in nodejs, but we need this done in .Net). If anyone has any suggestions how I can go about finding where the issue is it'd be greatly appreciated.
I've confirmed that the endpoint matches what the deployed WebSocket API Gateway url is.
Visual Studio 2017
.Net Core 2.1
AWSSDK.ApiGatewayManagementApi 3.3.100.23
Thanks!