DRAG DROP
You develop an ASP.NET MVC application. You plan to implement ASP.NET SignalR for real-time push
notifications. The application includes the following class:
You need to display the message.
How should you complete the relevant code segment? To answer, drag the appropriate code segment to the
correct location or locations. Each code segment may be used once, more than once, or not at all. You may
need to drag the split bar between panes or scroll to view content.
Select and Place:
Explanation:
Box 1: $.hubconnection();
Create a connection.
Box 2: con.createHubProyxy(‘MyHub’);
Declare a proxy to reference the hub.
Box 3: hub.start()(‘function’, function(hello) {
Start the connection
https://www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr
3rd Code Segment will be
hub.on(“hello”,function(message)){
According this link
https://docs.microsoft.com/en-us/aspnet/signalr/overview/guide-to-the-api/hubs-api-guide-javascript-client
–from the document
var contosoChatHubProxy = $.connection.contosoChatHub;
contosoChatHubProxy.client.addMessageToPage = function (message) {
console.log(message.UserName + ‘ ‘ + message.Message);
});
+1
Correct!
var connection = $.hubConnection();
var contosoChatHubProxy = connection.createHubProxy(‘contosoChatHub’);
chatHubProxy.on(‘addMessageToPage’, function (message) {
console.log(message.UserName + ‘ ‘ + message.Message);
});
var connection = $.hubConnection();
var contosoChatHubProxy = connection.createHubProxy(‘contosoChatHub’);
chatHubProxy.on(‘addMessageToPage’, function (message) {
console.log(message.UserName + ‘ ‘ + message.Message);
});