public static async Task <IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, TraceWriter log) { log.Info("Fire trigger called"); string requestBody = new StreamReader(req.Body).ReadToEnd(); var data = JsonConvert.DeserializeObject <FireMessage>(requestBody); dynamic mess = new ExpandoObject(); mess.Message = $"{data.PlayerId} fired at {data.Row}, {data.Column}"; await CosmosHandler.Fire(data.GameId, data.PlayerId, data.Row, data.Column, log); return(new OkObjectResult(JsonConvert.SerializeObject(mess))); }
private static async Task <SignalRMessage> GetMessage(HttpRequest req, TraceWriter log) { string requestBody = new StreamReader(req.Body).ReadToEnd(); var data = JsonConvert.DeserializeObject <InitGameMessage>(requestBody); dynamic mess = new ExpandoObject(); mess.User = "******"; mess.Message = $"A player connected to game server as {data.User}"; var g = await CosmosHandler.FindOpenGame(data.User, data.ClientId, log); return(new SignalRMessage { Target = "ReceiveMessage", Arguments = new object[] { mess } }); }