Ask A Question

Notifications

You’re not receiving notifications from this thread.

Weird error in cable ready?

Pito Salas asked in General

cable_ready 4.5.0
rails 6.1.4.1
ruby 3.0.2p107

This is a simple example from the basic tutorial (https://www.youtube.com/watch?v=F5hA79vKE_E) I suspect the error I am getting is because either cable_ready or rails evolved a little and created a tiny incompatibility.

When do the broadcast, I get this in the java console:

TypeError: undefined is not a function (near '..operations.forEach...")
- perform - cable readv.is:13
- received  - timeline_channel.js:15
- map
- message
WebSocket connection to 'ws://0.0.0.0:3011/cable' failed: WebSocket is closed due to suspension.

Here it is

It is triggered when in my controller I ask cable ready to:

cable_ready["timeline"].console_log(message: "***** cable ready post created")

[1]:

Which leads to my timeline_channel to:

received(data) {
    console.log("******** Received data:", data.operations)
    if (data.cableReady) CableReady.perform(data.operations)
  }

My interpretation is perform causes this line in cable_ready.js line 13:

  operations.forEach(function (operation) {
    if (!!operation.batch) batches[operation.batch] = batches[operation.batch] ? ++batches[operation.batch] : 1;
  });

Is finding something in the received data that it doesn't like.

That's where my trail ends. Can someone see what I am doing wrong, or tell me what other code you'd like me to include?

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 85,376+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.