Calling Public Function In Hub Through ButtonClick Works, Won't Work At Dcument Load. RRS feed

  • Question

  • User-224188520 posted

    Hey All, not sure what is going on with my code, here it is.

    (function () {
                var myHub = $.connection.ServerHub;
                $.connection.hub.logging = true;
                myHub.client.hello = function (message) {
                $("#btnClick").click(function () {

    I've tried all sorts of combination, I need to call myHub.server.adduser(); on Document.Load, it will not work in anything other then the button click event.

    Am I missing something here?

    adduser is just an insert into my db that captures the connectionid and user name.

    Saturday, April 22, 2017 2:55 AM


  • User-224188520 posted

    I missed this:

    $.connection.hub.start().done(function () {

    That did it.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, April 22, 2017 3:19 AM