Browser-less server-side websockets client in Azure - azure

I have an azure static web app that gets data via azure functions written in javascript.
I would like to subscribe to external data push services using wss websockets. The socket may be open for up to 24 hours. I thought, having read some answers on SO that I might be able to do this using durable functions but it appears that it isn't possible.
Almost all examples of using websockets in azure I've seen create a server, eg with SignalR, and communicate with the browser.
This helps. It shows how to build a server-side websockets client in a webjob
https://mikewaniewski.wordpress.com/2015/06/14/websocket-client-as-azure-webjob/
but as it is from 2015 I wondered if there more recent technologies available to do the same thing? Before I go about setting all that up.
Thanks in advance

Related

REST API Logs in Azure

Is there anyway to see all requests done via REST API?
I want to be able to monitor REST API calls done by a client ID. I want to look into what specific APIs were called, if possible how the request/response looks like for each call.
Just posting this here to help future question posters.
this is where you need to put some kind of monitoring inside your code. I dont think Azure has built in capabilities for tracking specific REST API calls. Application Insights can be customized to do this, yes, but not out of the box. Or, you could just build your own custom logging which is what I would do, have done
The OP has confirmed that this is indeed the case with Azure, after he spoke with the Azure support folks.
I hope you are talking about a web app or a mobile app calling a backend app which is running on azure or somewhere else. So for this the answer is using Application Insights, it is now part of Monitor but built for apps to monitor APM (Application Perf Monitoring).

Persistent application logs for NodeJS app on azure app service

I have a nodejs app which is nothing but a BOT built using Microsoft's bot builder framework. I created an azure app service to host this app. I would like to find a way to persist all the application logs and web server logs as well (if possible) to some persistent store. Just like native web applications where we can look up logs on a app server & debug the application issues.
After doing some research I found official document from microsoft on this but looks like it has following limitations.
We can't use file storage option of app service as it's good for 12
hours only so logs will not be saved forever.
Currently only .NET application logs can be written to the blob
storage. Java, PHP, Node.js, Python application logs can only be
stored on the file system (without code modifications to write logs
to external storage).
I would like to check if anyone has tried any different approach for nodejs app. If yes then please share.
Thank you.
So I would respond by saying that this is not really a Bot specific problem... meaning you would have the same problem if you were writing a vanilla Web API and wanted to have persistent logs. You need to pick on a logging technology that let's you log to a more persistent store than just the file system.
Since you're using Node you might want to look at leveraging the Winston logging framework which has an abstraction for various transports to be plugged in. Then you would plug in the Azure Storage Blob Transport when running in production and that will ensure that your logs are written out to Azure Storage.
Still, you'd have to go collect those from Azure Storage and aggregate them yourself which can be painful. If you really want real-time a distributed tracing system though, you might want to look into using Application Insights instead. There's even a Winston transport for that as well if you want to stay abstracted from using AI directly and just use it as another log stream.

Which Azure service should I use for SignalR websocket?

I am completely new to using Azure so I could use a little advice. Here is my scenario. I need to develop an application that was originally thought to be a windows service but is now to be deployed to Azure. The app is a scheduling application that reads from a DB and calls a couple of different APIs when it's time to either start or stop an event. The DB will be stored in Azure as well.
Initially, this sounds like a WebJob, but the issue is I also need for the app to be both host and client for a SignalR WebSocket. The intent of this is to have two instances communicate with each other and a backup self-promote if it loses communication with the primary. My understanding is that WebJobs don't support things like WebSockets.
Is there an Azure service that would work well for this. I can use a virtual machine but would like to avoid it if possible. Any help is appreciated. Thanks.
I think you're looking for this one:
https://azure.microsoft.com/en-us/services/signalr-service/
Docs:
https://learn.microsoft.com/en-us/azure/azure-signalr/signalr-overview
Sample code:
https://github.com/aspnet/AzureSignalR-samples

Web Apps Azure High Traffic

I am using Azure Web Apps to host my website. The website is loaded from a native apps for iOS and Android. During normal days non peak time , the web is operating as expected. However, from time to time , we are going to push out notification via apns or google gcm and that will drive users back to the apps. From there, content will be loaded from the website which is hosted from the Azure Web Apps.
During this peak times where there are thousands of requests coming in, there will be very high degree of fallout which results in errors.
It is shown in the picture below .
Traffic of the web apps after the push notification blasts
I have make sure that the database will not have any bottleneck during the operation. We are using SQL from Azure as well.
From the new portal, we are using service tier 'S1' for the App Services.
Previously, when the apps are developed, Web Apps and Mobile Services are separate service which are now join to become App Services.
Is there anything I could adjust from the azure backend or there is something which I missed out to handle ? Currently , we are also making the instance to be auto scaling.
As in conclusion, during high concurrent requests rushing in, the web apps seems to stop responding.
I would propose to implement the retry logic if there is no such yet and troubleshoot using the different modes.
UPD:
There is a detailed "analyzing performance" official guidance here - https://azure.microsoft.com/en-us/documentation/articles/app-service-web-troubleshoot-performance-degradation/ .
The most simple way to understand (or just mitigate) if the issue if somehow related to the underlying backend (throttling etc) is to change the mode site is working in. In your case, it can be S or even P.
Next step, if we eliminate the possibility of the throttling/etc, is to implement the diagnostics. My favourite tool is Application Insights, there is New Relic and other great tools as well. There are good guidances i saw and used:
http://www.asp.net/aspnet/overview/developing-apps-with-windows-azure/building-real-world-cloud-apps-with-windows-azure/monitoring-and-telemetry
https://github.com/mspnp/performance-optimization/blob/master/Assessing-System-Performance-Against-KPI.md#insertlink#
So, there is not silver answer about your question - highload is highload :-) Without access to the sources and website, and load tests results it is difficult to say what component of the project behaves itself bad.
If that is the helpful answer, please mark it as a helpful or as the answer. Thanks!

Using Windows Azure Service Bus From Silverlight

Is it possible to call services hosted on the Service Bus from a Silverlight application? I tried googling around but none of the results helped.
Looking at the samples (EchoService) they are using a specific microsoft DLL to setup the authentication for the service. I cannot seem to add this DLL to my project (duh it is for the full CLR) and am not sure how to replicate its behaviour while on the client side.
Thank you for your help.
You can use it. You have to host a cross access policy file service on the service bus (a service that serves this file) An example of a service that does this is given on Clemens Vaster's blog. (just google it, it's on the msdn site) It is included with the reverse web proxy.
You have to use queued the rest APIs. Refer to the Http queue example included with the SDK.
Note that with Silverlight, you'll have to make use of the async libraries.
I've looked at the November 2008 CTP code and getting the EchoService client to work from Silverlight is highly unlikely due to the dependancy on the NetTcpRelayBinding and Silverlight's limited TCP support.
I suggest getting your Silverlight client to call a back-end service that you control and proxy the requests to the Azure platform. Not an ideal solution, but a workaround for now.
Update: The Azure Service Bus is now accessible from Silverlight using REST API calls. See http://msdn.microsoft.com/en-us/library/ff797957.aspx for more information.

Resources