public async Task<bool> Post(ImageBlob imageBlob) { if (imageBlob == null || imageBlob.CanvasData == null) return false; // add the blob to blob storage/table storage var storedImageBlob = await imageBlobRepository.AddBlob(imageBlob); if (storedImageBlob != null) { BlobHub.SendFromWebApi(storedImageBlob); } return false; }
public void Send(ImageBlob latestBlob) { Clients.All.latestBlobMessage(latestBlob); }
//Called from Web Api controller, so must use GlobalHost context resolution public static void SendFromWebApi(ImageBlob imageBlob) { var hubContext = GlobalHost.ConnectionManager.GetHubContext<BlobHub>(); hubContext.Clients.All.latestBlobMessage(imageBlob); }