Correct the web socket url when creating consumer

In this https://github.com/rails/rails/blob/main/guides/source/action_cable_overview.md#connect-consumer  part of the documentation it mentions a url that has https in it, when it should be a web socket url as mentioned here https://guides.rubyonrails.org/action_cable_overview.html#client-server-interaction

This MR is to create the confusion and to have consistency across the docs for the web socket url

Update guides/source/action_cable_overview.md

Co-authored-by: Petrik de Heus <petrik@deheus.net>

Update guides/source/action_cable_overview.md

Co-authored-by: Petrik de Heus <petrik@deheus.net>

remove cable.js in action_cable overview

Update guides/source/action_cable_overview.md

Co-authored-by: Petrik de Heus <petrik@deheus.net>

Update guides/source/action_cable_overview.md

Co-authored-by: Petrik de Heus <petrik@deheus.net>

remove cable.js in action_cable overview

Update guides/source/action_cable_overview.md

Co-authored-by: Petrik de Heus <petrik@deheus.net>

Update guides/source/action_cable_overview.md

Co-authored-by: Petrik de Heus <petrik@deheus.net>

remove cable.js in action_cable overview
This commit is contained in:
Oli 2022-08-12 09:47:30 +02:00
parent 0c212836bc
commit 8a1ff2f414

@ -263,6 +263,8 @@ WebSocket is opened.
```js
// Specify a different URL to connect to
createConsumer('wss://example.com/cable')
// Or when using websockets over HTTP
createConsumer('https://ws.example.com/cable')
// Use a function to dynamically generate the URL
@ -270,7 +272,7 @@ createConsumer(getWebSocketURL)
function getWebSocketURL() {
const token = localStorage.get('auth-token')
return `https://ws.example.com/cable?token=${token}`
return `wss://example.com/cable?token=${token}`
}
```
@ -597,8 +599,7 @@ consumer.subscriptions.create("AppearanceChannel", {
#### Client-Server Interaction
1. **Client** connects to the **Server** via `App.cable =
ActionCable.createConsumer("ws://cable.example.com")`. (`cable.js`). The
1. **Client** connects to the **Server** via `createConsumer()`. (`consumer.js`). The
**Server** identifies this connection by `current_user`.
2. **Client** subscribes to the appearance channel via