Announcement

Collapse
No announcement yet.

can't post message to web worker, -- says "could not be cloned"

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    can't post message to web worker, -- says "could not be cloned"

    I have some simple code:
    public void GetBankruptcyForms(BankruptcyFormsQueryRequest request, Action<bool, IList<BankruptcyForm>> action)
    {
    // we need a simpler object to send over
    var formIds = request.FormIds.Select(f => f.Value).ToArray();
    string data = string.Join(",", formIds);
    _worker.postMessage(new {msg = "bankruptcy-forms", data = data});

    }

    It dies on the postMessage call with the below error:

    System.SystemException: DataCloneError: Failed to execute 'postMessage' on 'Worker': function () {
    this.$initialize();

    if (Class.$base) {
    ...<omitted>... } could not be cloned.
    Error: DataCloneError: Failed to execute 'postMessage' on 'Worker': function () {


    Originally, I wanted to post over the request object. I started to suspect that the rich "bridge" object couldn't be serialized this way, so I started trying to simplify it. However, now I'm down to a string and it's still not working. Funny thing is, I have this working in the same class where I post over only a string.

    Any suggestions? Or clues what that error is all about?
    Thanks
    Kevin
Working...
X