phoenixframework / phoenix_live_reload

Provides live-reload functionality for Phoenix
MIT License
315 stars 90 forks source link

transport/3 is deprecated #75

Closed mobileoverlord closed 5 years ago

mobileoverlord commented 6 years ago

I am currently using this in pace with phoenix master and am receiving warnings about the deprecation of transport/3 in the socket.

I understand I am running the edge and that organizing the dependency repositories is "coming soon". I have a fork where I just removed the calls to transport/3 and I updated the live reload socket declaration in my projects endpoint and its working. But I was curious if we are concerned about backwards compatibility or if semver is going to lock step everything for phoenix 1.4+

If thats the case, I can just PR my changes and we would just need to update the new project generator and docs if the socket transport layer is stable in phoenix master.

josevalim commented 6 years ago

Yeah, we will bump the requirement after 1.4 is out. --

José Valimwww.plataformatec.com.br http://www.plataformatec.com.br/Founder and Director of R&D

bzitzow commented 5 years ago

+1

Updating to phoenix 1.4.0-rc based on these instructions: https://gist.github.com/chrismccord/bb1f8b136f5a9e4abc0bfc07b832257e

$ mix compile
==> phoenix_live_reload
Compiling 4 files (.ex)
warning: transport/3 in Phoenix.Socket is deprecated.

Instead of defining transports in your socket.ex file:

    transport :websocket, Phoenix.Transport.Websocket,
      key1: value1, key2: value2, key3: value3

    transport :longpoll, Phoenix.Transport.LongPoll,
      key1: value1, key2: value2, key3: value3

You should configure websocket/longpoll in your endpoint.ex:

    socket "/socket", MyApp.UserSocket,
      websocket: [key1: value1, key2: value2, key3: value3],
      longpoll: [key1: value1, key2: value2, key3: value3]

Note the websocket/longpoll configuration given to socket/3
will only apply after you remove all transport/3 calls from
your socket definition. If you have explicitly upgraded to
Cowboy 2, any transport defined with the transport/3 macro
will be ignored.

  lib/phoenix/socket.ex:327: Phoenix.Socket.__transport__/4
  lib/phoenix_live_reload/socket.ex:9: (module)
  (elixir) src/elixir_compiler.erl:71: :elixir_compiler.dispatch/4
  (elixir) src/elixir_compiler.erl:68: :elixir_compiler.compile/3
  (elixir) src/elixir_module.erl:281: :elixir_module.eval_form/6

warning: transport/3 in Phoenix.Socket is deprecated.

Instead of defining transports in your socket.ex file:

    transport :websocket, Phoenix.Transport.Websocket,
      key1: value1, key2: value2, key3: value3

    transport :longpoll, Phoenix.Transport.LongPoll,
      key1: value1, key2: value2, key3: value3

You should configure websocket/longpoll in your endpoint.ex:

    socket "/socket", MyApp.UserSocket,
      websocket: [key1: value1, key2: value2, key3: value3],
      longpoll: [key1: value1, key2: value2, key3: value3]

Note the websocket/longpoll configuration given to socket/3
will only apply after you remove all transport/3 calls from
your socket definition. If you have explicitly upgraded to
Cowboy 2, any transport defined with the transport/3 macro
will be ignored.

  lib/phoenix/socket.ex:327: Phoenix.Socket.__transport__/4
  lib/phoenix_live_reload/socket.ex:10: (module)
  (elixir) src/elixir_compiler.erl:71: :elixir_compiler.dispatch/4
  (elixir) src/elixir_compiler.erl:68: :elixir_compiler.compile/3
  (elixir) src/elixir_module.erl:281: :elixir_module.eval_form/6
chrismccord commented 5 years ago

mix deps.update phoenix_live_reload

chrismccord commented 5 years ago

Oh whoops, ignore me. The warning will persist until final release, but will not be an issue.

ger619 commented 5 years ago

how was this issue solved?

josevalim commented 5 years ago

You have to update phoenix_live_reload.

ger619 commented 5 years ago

Unfortunately this has not worked phoenix_live_reload any help please