chrismccord

chrismccord

Creator of Phoenix

This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There have been a few deprecations, but this ugprade should be quick and easy for most folks.

Phoenix LiveDashboard

On the heels of the official LiveDashboard release, Phoenix 1.5 projects now ship with LiveDashboard by default, for real-time performance monitoring and debugging tools. It’s at this point I also want to re-welome Michael Crumm to the phoenix-core team! He has been heading up the Dashboard work with José, and we can thank them both for the amazing results we have today.

The Dashboard brings you immediate insight into your Phoenix applications with focus on production data. Even if you are just starting with Phoenix, we have tooltips on the widgets so you can learn more about them and if/when you should worry about system limits and the health of your system. With telemetry integration, we also include charting of Phoenix events, along with user-defined metrics.

Check José’s twitter thread to see a breakdown of features and screenshots:
https://twitter.com/josevalim/status/1250846714665357315

The dashboard also includes is also a streaming request logger. This is super convenient for diagnosing an issue in production where you need logs for specific requests but the regular logs drown out your requests in noise. With a button click, you can have all of your own request logs streamed to the dashboard instead of sifting thru a flood of production logs.

We also include a process tab, which is similar to observer, allowing you to sort processes in the system to find large message queues, memory hogs, etc.

Did we mention this Just Works™ for a cluster of distributed nodes? :slight_smile: Using the node drop-down selector, you can access all the data/features listed above for any node on the cluster, regardless of what web node you happened to load-balance to when loading the dashboard.

Phoenix LiveView generators

The phx.new project generator now includes a --live flag to include everything you need to get up and running developing with LiveView. Additionally, we have also added a phx.gen.live generator for boostrapping CRUD LiveView context/interfaces similar to phx.gen.html. We recommend taking these generators for a test drive to see all the existing improvements to LiveView that recently shipped:

  • Revamped LiveViewTest APIs for more powerful, workflow driven testing
  • Deep diff tracking for LiveView templates, dramatically reducing server payloads in many cases
  • Large performance improvements on client rendering
  • Live Navigation with Live Flash

PubSub 2.0

Phoenix.PubSub 2.0 has been released with a more flexible and powerful fastlane mechanism. We took this opportunity to also move Phoenix.PubSub out of the endpoint and explicitly into your supervision tree. This prevents race conditions at startup and decouples your PubSub system from the endpoint. Follow the upgrade guides linked below to get up to speed.

Revamped Guides

Thanks to efforts by @josevalim, the Phoenix built-in guides have been restructured and revamped, providing a better navigation structure and more content. Be sure to take a look if you’d like to freshen up on your phoenix knowledge.

Other notable improvements include built-in support for MSSQL databases via the tds adapter, and inclusion of the Phoenix.Ecto.CheckRepoStatus plug in new projects to detect and prompt for database creation/migration on new requests.

As always, we have provided upgrade guides to bring your existing applications up to speed:

Find us on elixir slack/irc if you have questions. Happy coding!

–Chris

Full changelog:

1.5.0

Enhancements

  • [Channel] Do not block the channel supervisor on join
  • [ConnTest] Add init_test_session to Phoenix.ConnTest
  • [Controller] Support :disposition option in send_download/3
  • [Endpoint] Allow named params to be used when defining socket paths
  • [Endpoint] Raise if force_ssl has changed from compile time to runtime
  • [Generator] Add mix phx.gen.live for LiveView CRUD generation
  • [PubSub] Migrate to PubSub 2.0 with a more flexible fastlaning mechanism
  • [View] Add render_layout which makes it easy to work with nested layouts
  • [Transport] Transports can now optionally implement handle_control/2 for handling control frames such as :ping and :pong

Deprecations

  • [ChannelTest] use Phoenix.ChannelTest is deprecated in favor of import Phoenix.ChannelTest
  • [ConnTest] use Phoenix.ConnTest is deprecated in favor of import Plug.Conn; import Phoenix.ConnTest
  • [Endpoint] The outdated Phoenix.Endpoint.CowboyAdapter for Cowboy 1 is deprecated. Please make sure {:plug_cowboy, "~> 2.1"} or later is listed in your mix.exs
  • [Endpoint] subscribe and unsubscribe via the endpoint is deprecated, please use Phoenix.PubSub directly instead
  • [Endpoint] Phoenix.Endpoint.instrument/4 is deprecated and has no effect. Use :telemetry instead. See Phoenix.Logger for more information
  • [Endpoint] The :pubsub key for endpoint is deprecated. Once you start your app, you will see step-by-step instructions on how to use the new PubSub config
  • [Layout] Use <%= @inner_content %> instead of <%= render @view_module, @view_template, assigns %> for rendering the child layout

phx.new installer

  • Built-in support for MSSQL databases via the tds adapter
  • Phoenix.PubSub is now started directly in your application supervision tree
  • Phoenix.Ecto.CheckRepoStatus is now added to new applications that use Ecto
  • Automatically use System.get_env("MIX_TEST_PARTITION") in the database name in the test environemnt for built-in CI test partitioning
  • Generate a MyApp.Telemetry module with examples of Telemetry Metrics you may want to track in your app
  • Support the --live flag for generating apps with out-of-the-box LiveView support

JavaScript client

  • Ensure all channel event listeners are called
  • Fix rejoining channels after explicit disconnect following be immediate reconnect
  • Prevent duplicate join race conditions by immediately leaving duplicate channel on client

Showing Posts 93 to 84

jayjun

jayjun

Yes. The problem is LiveView’s JavaScript reads window.location.href to say where it’s coming from. In your stack trace, you can see

"url" => "https://myapp.com/dashboards/my_app%4010.21.1.139"

is sent through WebSocket and LiveView (on the server) can’t match which live view sent that.

hrishi

hrishi

Because I’m using LiveDashboard and not LiveView directly, the

live_dashboard "/dashboards",
      metrics: MyApp.Telemetry,
      live_socket_path: "/dashboards/socket/live"

will resolve into LiveView paths.

If I understand correctly, I need to get rid of the rewrite for LiveView Router to work?

jayjun

jayjun

When navigating, LiveView checks your router directly to determine which live view module to load. It cannot be aware of any rewrite rules in your proxy.

hrishi

hrishi

@josevalim Can you maybe help here?

hrishi

hrishi

No, so the connect URI for socket will be wss://myapp.com/dashboards/socket/live this will get rewritten to
wss://<SVC-IP>/ext/dashboards/socket/live when my app gets the request. I can confirm that the websocket is connected successfully.

sfusato

sfusato

The scope "/ext" doesn’t affect the string given to :live_socket_path if that’s what you mean by the “rewrite rule”.

hrishi

hrishi

The /ext will be added by my rewrite rule.
I was able to connect the websocket but channel join crashed

The doc is not updated. The live_socket_path can be configured. See this

sfusato

sfusato

Reading the docs, I’m wondering if the fact that you’re missing /ext in the :live_socket_path config key is the culprit.

:live_socket_path - Configures the socket path. it must match the socket "/live", Phoenix.LiveView.Socket in your endpoint.

docs

hrishi

hrishi

Hey,
I keep getting the below error when trying out LiveDashboard behind a proxy. The error is being raised in Phoenix.LiveView.Utils #live_link_info! which I don’t completely understand.

Application Logs

22:11:52.198 IST CONNECTED TO Phoenix.LiveView.Socket in 183µs Transport: :websocket Serializer: Phoenix.Socket.V2.JSONSerializer Parameters: %{"_csrf_token" => "<token>", "_mounts" => "0", "vsn" => "2.0.0"}

22:11:52.209 IST GenServer #PID<0.3784.0> terminating ** (ArgumentError) cannot invoke handle_params nor live_redirect/live_patch to "https://myapp.com/dashboards/my_app%4010.21.1.139" because it isn't defined in MyAppWeb.Router (phoenix_live_view) 
lib/phoenix_live_view/utils.ex:227: Phoenix.LiveView.Utils.live_link_info!/3 (phoenix_live_view) 
lib/phoenix_live_view/channel.ex:652: Phoenix.LiveView.Channel.verified_mount/5 (phoenix_live_view) 
lib/phoenix_live_view/channel.ex:43: Phoenix.LiveView.Channel.handle_info/2 (stdlib) 
gen_server.erl:637: :gen_server.try_dispatch/4 (stdlib) 
gen_server.erl:711: :gen_server.handle_msg/6 (stdlib) 
proc_lib.erl:249: :proc_lib.init_p_do_apply/3 
Last message: {Phoenix.Channel, %{"params" => %{"_csrf_token" => "<token>", "_mounts" => 0}, "session" => "<token>", "static" => "<static>", "url" => "https://myapp.com/dashboards/my_app%4010.21.1.139"}, {#PID<0.3782.0>, #Reference<0.1011715969.1134034946.114165>}, %Phoenix.Socket{assigns: %{}, channel: Phoenix.LiveView.Channel, channel_pid: nil, endpoint: MyAppWeb.Endpoint, handler: Phoenix.LiveView.Socket, id: nil, join_ref: "4", joined: false, private: %{connect_info: %{}}, pubsub_server: MyApp.PubSub, ref: nil, serializer: Phoenix.Socket.V2.JSONSerializer, topic: "lv:phx-FhUWQLy7Dm1ONgEi", transport: :websocket, transport_pid: #PID<0.3782.0>}}

Below is the application configuration.

Rewrite Rule:
应用宝官网-全网最新最热手机应用游戏下载 >> /ext/dashboards

router.ex

scope "/ext" do
 live_dashboard "/dashboards",
      metrics: MyApp.Telemetry,
      live_socket_path: "/dashboards/socket/live"
end

endpoint.ex

 socket "/ext/dashboards/socket/live", Phoenix.LiveView.Socket
Enuzo

Enuzo

…And if anyone prefers a video tut, here you go. :slightly_smiling_face:

Where Next? Top

Trending in Phoenix News Top

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews