Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

74
Views
Rails API - how to send especific information with action cable for front-end

I'm trying to send for front-end an especific information (how many registers I have, with a colunm null in database), with ActionCable, but I'm using Rails Api mode.

I'm generate a channel, and don't create a authentication code (all can access), and create a method subscribed:

  def subscribed
    stream_from "password_channel"
  end

Configured CORS and WebSocket access. After I call the channel with this code in controller, to send a message for subscribed clients.

PasswordChannel.broadcast_to("password_channel", { title: "Oi" })

And create this js for consume informations in WebSockets

let webSocket = new WebSocket("ws://localhost:3000/cable")

webSocket.addEventListener("message", function(event) {
    console.log(event)
})

This js return this object:

Object

But this object don't have the information { title: "Oi" }

Here it is github repository

Can anyone help me figure out what I'm doing wrong? =)

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!