I figured the demos are pretty straight forward but i get the impression I need to specify something that is currently missing.
Can anyone see what I missed?
I had to change the line "var hubStart = connection.start({ jsonp: true });" to "var hubStart = connection.start();" because i got a "jsonp is disabled" error, I read up on it and my understanding was that this was a cross domain feature which I don't need since im only pulling data from a hub on the current app / domain so i took it out.
I also got the impression that this was regression from the COR stuff which is event driven rather than polling (so less advanced forcing a regression).
So here's my MVC view code ...
And here's my hub code ...
For now it's a just simple "respond with what you get", notice that I have a hard coded static type called "Database", and Database.Submissions just returns a list of submission objects (as if to simulate a database call but from ram)
Can anyone see what I missed?
I had to change the line "var hubStart = connection.start({ jsonp: true });" to "var hubStart = connection.start();" because i got a "jsonp is disabled" error, I read up on it and my understanding was that this was a cross domain feature which I don't need since im only pulling data from a hub on the current app / domain so i took it out.
I also got the impression that this was regression from the COR stuff which is event driven rather than polling (so less advanced forcing a regression).
So here's my MVC view code ...
01.@section scripts02.{03.<script>04. $(function () {05. var hubUrl = "/signalr/hubs";06. var connection = $.hubConnection(hubUrl, { useDefaultPath: false });07. var hub = connection.createHubProxy("submissionHub");08. var hubStart = connection.start();09. 10. $("#notification").kendoNotification({11. width: "100%",12. position: {13. top: 0,14. left: 015. }16. });17. $("#grid").kendoGrid({18. editable: true,19. sortable: true,20. dataSource: {21. type: "signalr",22. autoSync: true,23. // Handle the push event to display notifications when push updates arrive24. push: function (e) {25. var popupNotification = $("#popupNotification").data("kendoNotification");26. popupNotification.show(e.type, "success");27. },28. schema: {29. model: {30. id: "SubmissionId",31. fields: {32. "SubmissionId": { editable: false },33. "FirstName": { type: "text" }34. }35. }36. },37. sort: [{ field: "SubmissionId", dir: "desc" }],38. transport: {39. signalr: {40. promise: hubStart,41. hub: hub,42. server: {43. read: "read",44. update: "update",45. destroy: "destroy",46. create: "create"47. },48. client: {49. read: "read",50. update: "update",51. destroy: "destroy",52. create: "create"53. }54. }55. }56. }57. });58. });59. 60. 61.</script> 62.}63. 64.<div id="grid" data-role="grid" style="height: 200px">65.</div>And here's my hub code ...
For now it's a just simple "respond with what you get", notice that I have a hard coded static type called "Database", and Database.Submissions just returns a list of submission objects (as if to simulate a database call but from ram)
01.using Microsoft.AspNet.SignalR;02.using Test_Project.Models;03. 04.namespace Test_Project.Hubs05.{06. public class SubmissionHub : Hub07. {08. public void Read()09. {10. Clients.All.Read(Database.Submissions.ToArray());11. }12. 13. public void Update(Submission submission)14. {15. Clients.All.Update(submission);16. }17. 18. public void Destroy(Submission submission)19. {20. Clients.All.Destroy(submission);21. }22. 23. public void Create()24. {25. Clients.All.Create(new Submission());26. }27. }28.}