Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8535089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:21:03+00:00 2026-06-11T10:21:03+00:00

This works fine class Window.AppViewModel message : ko.observable() chatMessages : ko.observableArray() canSendMessage : ko.observable(false)

  • 0

This works fine

class Window.AppViewModel
    message : ko.observable("")
    chatMessages : ko.observableArray()
    canSendMessage : ko.observable(false)
    Window.sHub.addMsg = (data) =>  
        @::chatMessages.push(data)

whereas this

class Window.AppViewModel
    constructor : ->
        @message = ko.observable("")
        @chatMessages = ko.observableArray()
        @canSendMessage = ko.observable(false)
        Window.sHub.addMsg = (data) =>  
            @chatMessages.push(data)

Results in my server side hub recieving server messages but it can’t make any callbacks.

What am I missing here??? This is driving me up the wall. Obviously the prototype based solution will work because it’s making everything “static” but I’m crippled because I can’t write nicely separated code at the moment.

Is there any way to see what the hub is trying to invoke?? The SignalR documentation talks about tracing/logging but never explains how.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T10:21:05+00:00Added an answer on June 11, 2026 at 10:21 am

    All wired client events can be found by adding a small snippet to the “On” anonymous function in jquery.SignalR in the hubProxy prototype

    So now it looks something like this

       on: function (eventName, callback) {
                /// <summary>Wires up a callback to be invoked when a invocation request is received from the server hub.</summary>
                /// <param name="eventName" type="String">The name of the hub event to register the callback for.</param>
                /// <param name="callback" type="Function">The callback to be invoked.</param>
                var self = this;
    
                // Normalize the event name to lowercase
                eventName = eventName.toLowerCase();
                console.log(eventName + " callback was registered on the client");
                $(self).bind(eventNamespace + eventName, function (e, data) {
                    callback.apply(self, data);
                });
                self.subscribed = true;
                return self;
            }
    

    And gives you nice output of what client methods can be called back from the server

    Also, I learned that CreateHubProxies (reflects through the callbacks you add) is only called once for an entire hub.Start()–So all methods must be added to the hub proxy before you start.

    This should definitely be on the github wiki. It makes sense but it isn’t obvious.

    Edit : It would make sense to allow you to call CreateHubProxies multiple times. People are accustom to writing Knockout.js code in a way where they delay allocating a viewmodel until a certain event happens–if your viewmodel has any SignalR callbacks, this isn’t impossible. Having to create all of your viewmodels upfront is a bit of a kludge. You could even keep it pretty lean by keeping a list of proxy members already generated and excluding them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I´m dynamically creating an instance of a class with reflection and this works fine,
This works fine: var vm = {}; $.getJSON('file.json', function (data) { vm.objects = data;
This seems to work fine in C#: class A : System.Attribute { public A()
This works fine: $.getJSON(http://localhost:59396/xxxWeb/ CarouselHandler.ashx?action=getproducts&ids= + ids, function(data) { carousel.size(allProductIDs.length); if (numberOfImagesLeftToShow < numberOfImagesToDisplay)
This works fine: GET /mvc/Movies/TitleIncludes/Lara%20Croft When I submit a request that contains a colon,
This works fine: [655971, 2343, 343].map(function(x) { return parseInt(x) }) // [655971, 2343, 343]
This works fine: TreeMap <String, ArrayList> x_probs_org = new TreeMap<String, ArrayList>(); But this: TreeMap
I'm targeting the framework 4.0 and this works fine on the development machine, I
At the end of a ggplot, this works fine: + opts(title = expression(Chart chart_title...))
We currently have a working php mail script, this works fine and as we

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.