ちょっと、SignalRのシンプルなサンプルチュートリアルに従っています。hereです。チャットシステムを作成することができます。私はそれを終了したと私は何も起こりません送信クリックします。SignalRシンプルチャットの例:交渉が滞っている
デバッガがHubクラスのSendメソッドの内部に入っていないため、onclickボタンに警告を表示していましたが、$ .connection.hub.start()。 。(関数()のは、私は推測しています行われません達しないので、オフに発射されていない
私は、ロギングをオンにし、すべてのログがになるには、次のとおりです。
[21時46分52秒GMT-0600(マウンテンSignalR: '/signalr/negotiate?clientProtocol=1.5'との交渉SignalR:ハブ 'chathub'に加入しているクライアント
[21:46:52 GMT-0600(山岳夏時間)]connectionData =%5B%7B%22name%22%3A%22chathub%22%7D%5D '。以下のコードで
ルック:
$(document).ready(function() {
$(function() {
// Declare a proxy to reference the hub.
var chat = $.connection.chatHub;
$.connection.hub.logging = true;
// Create a function that the hub can call to broadcast messages.
chat.client.broadcastMessage = function (name, message) {
// Html encode display name and message.
var encodedName = $('<div />').text(name).html();
var encodedMsg = $('<div />').text(message).html();
// Add the message to the page.
$('#discussion').append('<li><strong>' + encodedName
+ '</strong>: ' + encodedMsg + '</li>');
};
// Get the user name and store it to prepend to messages.
$('#displayname').val(prompt('Enter your name:', ''));
// Set initial focus to message input box.
$('#message').focus();
// Start the connection.
$.connection.hub.start().done(function() {
$('#sendmessage').click(function() {
// Call the Send method on the hub.
alert($('#message').val());
chat.server.send($('#displayname').val(), $('#message').val());
// Clear text box and reset focus for next comment.
$('#message').val('').focus();
});
});
});
});</script>
問題が何であるか上の任意のアイデア?これをデバッグするのは地獄です!私はウォークスルーを正確に続けました。 jQueryの3を使用して
、SignalR 2.2.1
エラーハンドラを追加してみます。 '$ .connection.hub.error(function(error){console.log( 'SignalR error:' + error)}))' –