Click here to Skip to main content
15,884,083 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
Hi Everyboby
I create one real time application with SignalR.
I'm follow some example and extend the idea.
Now I got some issue about of that idea.
I make a sample application as 'Job Information Application'.
The sample project aim is I'm insert new job informations at Entry Form and
the other side can see in Job Listing as real time job informations comming. I'm using MSSQL server and EntityFramework.
I don't want to use SqL Dependancy. The process is when I add new jobs data, the backend process will notify to SignalR Hub and client will get that response.
=>Please see sample flow[^]
There is no issue with single form(only one page) JobEntry. After adding job data, update job informations are effect to all client browser fot this page.
I don't want it. I want to see it from another page.
But I'm get the error when I using multi page for retrieve job information from SignalR Hub.

"NetworkError: 404 Not Found - http://localhost:11325/Home/signalr/hubs"
Error: SignalR: Error loading hubs. Ensure your hubs reference is correct, e.g. <script src='/signalr/js'></script>.

I think it is issue of SignalR Hub initialize. I'm initialize scripts reference all of page.
JavaScript
 <script src="~/Script/jquery-1.9.1.js"></script>
    <script src="~/Script/jquery.signalR-2.0.3.min.js"></script>
    <script src="signalr/hubs"></script>
    <script type="text/ecmascript">
        $(function () {            
            var myHub = $.connection.jobHub;
	$.connection.hub.start();
        }
</script>

But, get error.So I'm change initialize scripts reference to Layout page(Master Page) and reference that layout.
JavaScript
<script src="~/Scripts/jquery-2.1.0.js"></script>
    <script src="~/Script/jquery.signalR-2.0.3.min.js"></script>
    <script src="signalr/hubs"></script>

This one is still get error.
Please help me, How to use Single Hub - Multi Form ?
Please suggest any solution.
Thanks All,
   MinChanSike
Posted
Updated 1-Apr-14 10:09am
v3

 
Share this answer
 
Thank Nimit
I get the solution it.
It is coz of initialize hub issue.

<script src="signalr/hubs"></script>
I just change to
<script src="@Url.Content("~/signalr/hubs")" type="text/javascript"></script>

Later, I'll share the solution with project.

Thanks,
MinChanSike
 
Share this answer
 
Comments
Nimit Joshi 7-Apr-14 0:11am    
its my pleasure...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900