How to setup a basic websocket connection

I have just started to explore RoR and not able to setup a websocket test connection which shows in browser console logs as “connected”.

I have setup the things with ActionCable like routes and creating a channel. How do I test the websocket connection? I just see nothing in developer tools which means client is not able to connect to websocket.

Here are my setup files:

route file:

mount ActionCable.server => '/cable'

cat config/cable.yml

  adapter: redis
  url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
  channel_prefix: my_app_production

production.rb file

config.action_cable.url = "wss://"
config.action_cable.allowed_request_origins = [ "" ]


class MessagesChannel < ApplicationCable::Channel
  def subscribed
     stream_from 'MessagesChannel'

  def unsubscribed
    # Any cleanup needed when channel is unsubscribed


import { createConsumer } from "@rails/actioncable"
//export default createConsumer()
export default createConsumer("wss://")


import consumer from "channels/consumer"

consumer.subscriptions.create("MessagesChannel", {
  connected() {
    // Called when the subscription is ready for use on the server

  disconnected() {
    // Called when the subscription has been terminated by the server

  received(data) {
    // Called when there's incoming data on the websocket for this channel

I am using passenger with nginx with below contents:

    passenger_root /home/test/.rvm/gems/ruby-3.1.4/gems/passenger-6.0.18;
    passenger_ruby /home/test/.rvm/gems/ruby-3.1.4/wrappers/ruby;
server {
        listen       80;

location /cable {
        passenger_app_group_name my_app_action_cable;
        passenger_force_max_concurrent_requests_per_process 0;
root /var/www/my_app/public;
         passenger_enabled on;
         rails_env production;
         passenger_ruby /home/test/.rvm/gems/ruby-3.1.4/wrappers/ruby;