From 412a07d19bd5496b6cbb68cb0c00caaaf351dc96 Mon Sep 17 00:00:00 2001 From: Alex <7684726+alexcybernetic@users.noreply.github.com> Date: Wed, 14 Aug 2024 13:28:00 +0200 Subject: [PATCH] Improve channel docs and example code (#5898) * fix Step 2, template filename * fix comment/example heex template filename to hold the script tag --- guides/real_time/channels.md | 2 +- priv/templates/phx.gen.socket/socket.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/real_time/channels.md b/guides/real_time/channels.md index 99259abd0f..f2b12fb236 100644 --- a/guides/real_time/channels.md +++ b/guides/real_time/channels.md @@ -410,7 +410,7 @@ Now our `conn.assigns` contains the `current_user` and `user_token`. ### Step 2 - Pass the Token to the JavaScript -Next, we need to pass this token to JavaScript. We can do so inside a script tag in `lib/hello_web/components/layouts/app.html.heex` right above the app.js script, as follows: +Next, we need to pass this token to JavaScript. We can do so inside a script tag in `lib/hello_web/components/layouts/root.html.heex` right above the app.js script, as follows: ```heex diff --git a/priv/templates/phx.gen.socket/socket.js b/priv/templates/phx.gen.socket/socket.js index dd178f483a..80e8453e25 100644 --- a/priv/templates/phx.gen.socket/socket.js +++ b/priv/templates/phx.gen.socket/socket.js @@ -32,7 +32,7 @@ let socket = new Socket("/socket", {params: {token: window.userToken}}) // end // // Now you need to pass this token to JavaScript. You can do so -// inside a script tag in "<%= web_prefix %>/templates/layout/app.html.heex": +// inside a script tag in "<%= web_prefix %>/templates/layout/root.html.heex": // // //