Signalr implementation in mvc - signalr

I have few charts to render in the UI. The data has been populated from multiple tables using a web API service. Whenever a change in the data, I get a notification in the web API service. My question is that, is it possible use signalr to refresh data real-time.
Is it possible to invoke a signalr client methods from the web API service? Your help is highly appreciated.

It is possible to invoke client methods from outside the hub. You need to use GlobalHost to do that. You can find more details in the tutorial.

Related

How to create the webhook receiver kind of in Xamarin form(Android and iOS)?

I want to create the Xamarin Form app for both android and iOS in which when something events occurs or data update on server than server call my xamarin app and i will perform some task in my app. Push notification and SignalR both are not suitable for my case. is there anything like webhook in Xamarin form. There are many example for Web application but nothing i found in case of mobile application.
You can use the RESTful web service as a webhook.
Representational State Transfer (REST) is an architectural style for building web services. REST requests are made over HTTP using the same HTTP verbs that web browsers use to retrieve web pages and to send data to servers.
More informations you can refer to this website:
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/data-cloud/web-services/rest

How Do You Call A REST API From Within Watson Conversation?

I am testing out this android chat application using Bluemix https://github.com/IBM-Bluemix/chatbot-watson-android
At some point in the conversation I will need to call a REST API/webservice to retrieve info about data that has been gathered and send it back to the user as a chat.
I don't want to do it from within the android application as the application wont work when I deploy it to another platform (e.g. slack).
Is there a way to call REST APIs from within watson?
I don't think the conversation service can do it directly, but can it link to another Bluemix service and use the result of that?
If you are already using some form of middleware this can be achieved by setting an action tag in the .JSON editor of the node that should fire the action. This then gets picked up by your middleware listener.
Alternatively try the new cloud actions feature that has just been released here https://console.bluemix.net/docs/services/conversation/dialog-actions.html#dialog-actions which is really simple and easy
I would create a server to intermediate the communication between your app (android) and the conversation service. This server could call/retrieve the required data before sending the conversation response to your app.
As you're using Bluemix, you could use Node-Red to easily do this.
Here is an example of an app that I made exactly this.
If you are starting with Watson and Bluemix, I strongly advice trying to use the Node-red starting pack. It's really easy to integrate Watson services and call REST API/web-services, even integrate with a database.
Here is a starting point to this:
https://nodered.org/docs/platforms/bluemix
Happy coding!

how to consume backend services in maximo anywhere mobile app

I would like to know how we can consume web services in maximo anywhere apps. Currently im accessing static data from javascript files.Please help with sample code.
Webservice can be invoked using the Javascript adapters which are deployed on the server. The javascript methods in the mobile-app will invoke the methods in the adapter which in turn invokes the methods in the backend.
Sample code can be found in the below URL.
https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/7.1/server-side-development/javascript-adapters/js-http-adapter/#creatingSoapServiceRequest

The best option for sending asynchronous callbacks from a Web API to a .NET client

I have the following scenario in my project :-
The client makes use of ASP.NET Web API to make HTTP service requests. The Web API sits on top of a couple of WCF services, which in-turn handle all the business logic. The client subscribes to a particular type of event with the Web API. Whenever the Web API receives notifications from the internal WCF services about the occurrence of the event, the Web API in-turn needs to notify (push events to) all the subscribed clients about the events along with their details.
I want to understand the different options which are available for
sending asynchronous callbacks from an ASP.NET Web API to the
clients.(Currently we are working on a prototype for which the
client is a C# Windows Forms application. Later we might opt for
ASP.NET MVC4 web application.).
I also want to know which option would be ideal to send asynchronous
notifications back to the client when the data that accompanies the notification is of large sizes. In our scenario, the notification data that is sent back from the service may be of large sizes (~ in the range of 5KB - 50 MB).
In our scenario which I described above, can SignalR be used for notifying the c# client from Web API, as and when the Web API receives the callback from the internal WCF services?
Note :- The Web API is currently hosted in a Windows Service and the client is a .NET Windows Forms application.
Any pointers to such code samples or directions on how this can be achieved would be extremely helpful.
Cheers
SignalR is a good fit for the scenario you're describing, so I'd suggest using it for the notifications (especially since you want to start with a WinForms application and later switch to browser clients - with SignalR, you'll be able to connect to the same server-side code).
However, I'd also suggest keeping the notication messages lightweight, so instead of sending the data to the client with them, I'd send a token the client can retrieve the data with from WebAPI (SignalR isn't really ideal for large file transfers).

SignalR connecting to existing WebApi Service to get updates

Just an outline of what I am trying to do.
I have an existing WebApi service that returns the running windows services on a machine. I have a front end hooked up so that it querys the service using jQuery and Knockout.js
What I am trying to do with SignalR is to use it to poll the WebAPi service to always push the latest changes to the client.
Is SignalR the right framework for this?
Can someone provide me an example of calling a RESTful service with SignalR?
What i would really like to happen is if a service goes down that SignalR would raise that all the way through the WebApi to the Client.
SignalR is not the right framework for creating or consuming RESTful services. SignalR is designed to make it easy to push data from the server to the client. REST is designed to support clients making requests and receiving a (near) immediate responses.
You can make requests from a SignalR client to a server-side Hub method, but Hub methods do not expose REST endpoints.

Resources