New Discussion

Notifications

You’re not receiving notifications from this thread.

Weird error in cable ready?

0
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?

Join the discussion
Create an account Log in

Learning Ruby on Rails? Join our newsletter.

We won't send you spam. Unsubscribe at any time.