KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to get a super simple hub connection working cross-domain but having no luck. I've read dozens of posts and done everything mentioned but still no success. My server hub is here public class ChatHub : Hub { public void Send(string name, string message) { Clients.All.broadcastMessage(name, message); } } My server MapHubs call is here RouteTable.Routes.MapHubs(new HubConfiguration { EnableCrossDomain = true }); Any my javascript client is here <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>Index</title> <script src="~/Scripts/jquery-2.0.1.min.js"></script> <script src="~/Scripts/jquery.signalR-1.1.2.min.js"></script> <script src="/signalr/hubs"></script> </head> <body> <div class="container"> <input type="text" id="displayname" value="Test" /> <input type="text" id="message" value="I'm here" /> <input type="button" id="sendmessage" value="Send" /> </div> <script type="text/javascript"> $(function () { $.connection.hub.url = 'http://<my url>/'; var chat = $.connection.chatHub; alert(chat); $.connection.hub.start().done(function () { alert("Connection succeeded"); }).fail(function () { alert("Connection failed"); }); }); </script> </body> </html> The problem is that it never reaches the Connection succeeded or failed alerts and the alert(chat) call returns undefined. I've tried several combinations for the $.connection.hub.url line $.connection.hub.url = 'http://<My url>'; $.connection.hub.url = 'http://&
Tags (comma-separated)
Save Edits
Cancel