Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[FunctionName("NewDocumentNotify")]
public static async Task Run(
[CosmosDBTrigger(databaseName: "namesdata", collectionName: "firstletterstrend",
ConnectionStringSetting = "CosmosDbConnection",
CreateLeaseCollectionIfNotExists = true)]IReadOnlyList<Document> newDocuments,
[SignalR(HubName = "FirstNameLetterTrend")]IAsyncCollector<SignalRMessage> signalRMessage,
ILogger log)
{
log.LogInformation($"Sending {newDocuments.Count} documents");
await signalRMessage.AddAsync(new SignalRMessage
{
Target = "newFirstLetterData",
Arguments = newDocuments
.Select(doc => JsonConvert.DeserializeObject<AggregateLetterCountDocument>(doc.ToString()))
.ToArray()
});
}
[FunctionName("negotiate")]
public static SignalRConnectionInfo GetSignalRInfo(
[HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequest req,
[SignalRConnectionInfo(HubName = "FirstNameLetterTrend")] SignalRConnectionInfo connectionInfo)
{
return connectionInfo;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.