2021-07-19 01:42:15 +00:00
|
|
|
|
$(function () {
|
|
|
|
|
|
|
|
|
|
var connection = new signalR.HubConnectionBuilder().withUrl("/codeHub").build();
|
|
|
|
|
|
2021-07-19 02:17:18 +00:00
|
|
|
|
//let $code = $('#code');
|
|
|
|
|
//let $mirror = $('#mirror');
|
2021-07-19 01:42:15 +00:00
|
|
|
|
|
2021-07-19 02:17:18 +00:00
|
|
|
|
//$('#code').keyup(function () {
|
2021-07-19 01:42:15 +00:00
|
|
|
|
|
2021-07-19 02:17:18 +00:00
|
|
|
|
// let user = 'ryan';
|
|
|
|
|
// let message = $code.val();
|
2021-07-19 01:42:15 +00:00
|
|
|
|
|
2021-07-19 02:17:18 +00:00
|
|
|
|
// connection.invoke("SendMessage", user, message).catch(function (err) {
|
|
|
|
|
// return console.error(err.toString());
|
|
|
|
|
// });
|
|
|
|
|
//});
|
2021-07-19 01:42:15 +00:00
|
|
|
|
|
2021-07-19 02:17:18 +00:00
|
|
|
|
//connection.on("ReceiveMessage", function (user, message) {
|
2021-07-19 01:42:15 +00:00
|
|
|
|
|
2021-07-19 02:17:18 +00:00
|
|
|
|
// $mirror.val(message);
|
2021-07-19 01:42:15 +00:00
|
|
|
|
|
2021-07-19 02:17:18 +00:00
|
|
|
|
//});
|
2021-07-19 01:42:15 +00:00
|
|
|
|
|
|
|
|
|
connection.start().then(function () {
|
|
|
|
|
//$('#send').prop('disabled', false);
|
|
|
|
|
}).catch(function (err) {
|
2021-07-19 01:24:08 +00:00
|
|
|
|
return console.error(err.toString());
|
|
|
|
|
});
|
|
|
|
|
});
|