0

currently, am working on client server application using 3 layer architecture, User interface, API and than agsxmpp Library.

Hubs are written in class library, I want to create the object of hub from front end. below is the script, I have included all the packages of signal r in both class library and asp.net web forms.

<script src="/signalr/signalr/hubs"></script>
<script type="text/javascript">
    $(function () {

        //how can I create the object of hub which exists in class library
        var connectionChat = $.connection.connectionChat;
        debugger;
    });
</script>

how can I create hub instance in three layer architecture

enter image description here

bilal
  • 648
  • 8
  • 26

1 Answers1

0

You keep your owin in your class library, it should know where it is.

var connectionChat = $.hubConnection();
var chatProxy = connectionChat.createHubProxy('HubNameHere');

var message = 'message to be sent';

connectionChat.on('addMessageToPage', function(userName, message) {
console.log(userName + ' ' + message);

connectionChat.start();
Kelso Sharp
  • 972
  • 8
  • 12
  • my questions is I have a class library and a web project, hubs are written in class library project, I want to create proxy for the hub from java script. secondly, where I keep my owin class in C# library project or web project? – bilal Oct 26 '16 at 04:43