0

When every I attempt to add a new server callback function I cannot seem to get the callback to show up in the $.connection server callback list.

What do I need to do to refresh the javascript that SignalR produces and sends to the client with the latest list of server callbacks.

I would think that I should be able to just add a server callback for the client to call and rebuild my app and fire up a new instance of Google Chrome and the newly added server callback would be in the list of available callbacks on the client.

For example here is exactly what I've done.

1.) A client joins a group and everyone is notified.

      public override Task OnConnected()
    {
        string pid = this.Context.QueryString["pid"],
               uid = this.Context.QueryString["uid"],
               ispro = this.Context.QueryString["ispro"];

        Groups.Add(this.Context.ConnectionId, pid);

        return Clients.Group(pid).joined(new cmsg(Context.ConnectionId, UtilCommon.GetUserMini(new Guid(uid), bool.Parse(ispro))));
    }

2.) On the client the joined function is called from the server

       this.collaborateHub.client.joined = function (cmsg) {
        //
        that.chatBox.addAttendee(cmsg);

        //let the new attendee know about you
        if (cmsg.cnnid !== that.chatBox.getMeAttendee().cnnid) {
            that.chatBox.getMeAttendee().newbieid = cmsg.cnnid;
            debugger
            this.server.addMeNewbie(that.chatBox.getMeAttendee());
        };
    };

3.) Now, if someone joined and it was not the user of the currently opened window, that means the someone how just joined is someone other than myself, so I need to call the server back and notify the newly joined user to add me to their user list. I stead of having to keep up with the currently signed on users to the given group in a database, I am just using every signed on client of the group as a distributed database and let them manage their own info.

So, I need to call the server callback named addMeNewbie; however, this callback function is not available in the list.

 public Task addMeNewbie(cmsg cmsg) {

        return Clients.Client(cmsg.newbieid).addCurrAttendee(cmsg);
    }

Here is a snapshot of the client side in debug mode Debug Snapshot

4.) And finally here is the client side callback that i need the server to call so that the newly joined group member can update their list of current group members.

     this.collaborateHub.client.addCurrAttendee = function (cmsg) {
        debugger
        that.chatBox.addAttendee(cmsg);
    };

I would think that I should be able to add as many server callbacks as I want and they should show up on the next build and restart of a new instance of Google Chrome; however, this is not the case. What do I need to do to get newly added server callbacks to show up in the available server callbacks on the client side? This doesn't make since to me, but I am thinking maybe this is a cashing issue or something?

The only callback that is available is the one shown in the snapshot provided. At this time I've only got two callbacks, the one that you see in the snapshot and the one that is not visible.

1 Answers1

0

Somewhere along the way I created a signalr-hubs.js file from the generated JavaScript file that can be retrieved by http://localhost:3250/signalr/hubs and was adding new server functions to my hub but not updating the signalr-hugs.js file.

At this point every time I add a new server callback I retrieve the newly generated proxy by placing this url http://localhost:3250/signalr/hubs into the browser, coping the code, and then updating my signalr-hubs.js file.