- https://hexdocs.pm/phoenix/channels.html
- https://github.com/dsander/phoenix-connection-benchmark
- https://pusher.com/pricing
- https://www.digitalocean.com/pricing/
See https://gist.github.com/wavell/0411d52a69f03546f712b47596dd5ca4
tmux
git clone [email protected]:vulk/elixir-pusher-clone-training.git
nvm list
nvm use v6.0.0
If issues ...
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
rvm list
rvm use 2.2.3
rails -v
kerl list builds
kerl install 18.0 18.0
. 18.0/activate
kiex list
kiex use 1.4.5
iex
rails new pusher_lite_demo
cd pusher_lite_demo
copy gemfile
bundle update
rake rails:update:bin #to fix problems with a cloned machine -- overwrite all
copy app/models/pusher_event.rb model
rails g controller home
copy app/controllers/home_controller.rb controller
rails g controller events
copy app/controllers/events_controller.rb controller contents
copy views/layouts/application.html.erb template
copy app/views/home/index.html.erb template
copy app/views/events/create.js.erb template
delete app/assets/stylesheets/application.css
delete app/assets/stylesheets/events.scss
delete app/assets/stylesheets/home.css
delete app/assets/javascripts/events.coffee
delete app/assets/javascripts/home.coffee
copy app/assets/stylesheets/purecss.scss styles
copy app/assets/stylesheets/application.scss styles
copy .env.example into .env
copy .gitignore
copy pusher_lite_demo/config/initializers/assets.rb
copy pusher_lite_demo/config/initializers/pusher_lite.rb
copy pusher_lite_demo/config/routes.rb
. .env; rails s -p $PORT -b 0.0.0.0
mix phoenix.new ex_pusher_lite --no-brunch --no-ecto
cd ex_pusher_lite
copy .gitignore
copy mix.exs
mix do deps.get, compile
copy dev.exs
-- List of mix tasks for reference
https://hexdocs.pm/phoenix/mix_tasks.html
mix phoenix.gen.json Events events --no-context --no-model --no-schema
copy web/controller/events_controller.ex controller
copy web/router.ex router
mix phoenix.gen.channel Room
copy web/channels/user_socket.ex socket
copy web/channels/room_channel.ex socket
mix compile
edit /config/secrets.yml
edit app/models/pusher_event.rb model (add net http call)
rails g job send_events
copy app/jobs/send_events_job.rb job
edit web/controller/events_controller.ex controller
. .env; PORT=<yourport> iex -S mix phoenix.server
. .env; rails s -p $PORT -b 0.0.0.0
http://nandovieira.com/using-es2015-with-asset-pipeline-on-ruby-on-rails
copy app/assets/config/manifest.js edit app/assets/javascripts/application.js << redundant, but need this
copy app/assets/javascripts/phoenix.es6 copy app/assets/javascripts/application/boot.es6
copy app/assets/javascripts/application/pages/home/index.es6
copy config/initializers/babel.rb
edit Gemfile
bundle update
6. Test: go to url:port and enter a message, should receive message on the same screen with anyone connected to your url
rails g helper guardian copy app/helpers/guardian_helper.rb helper
edit app/models/pusher_event.rb model
edit app/assets/javascripts/application/pages/home/index.es6
edit mix.exs
edit config.exs
copy dev.secret.exs
edit dev.exs << add import config
mix do deps.get, compile
edit router.ex router
edit events_controller.ex controller
edit user_socket.ex socket
edit room_channel.ex channel
copy ex_pusher_lite/lib/ex_pusher_lite/guardian_serializer.ex
edit (rails) app/views/layouts/application.html.erb template -- add guardian line
Special thanks to Fabio Akita at http://www.akitaonrails.com/ for the blog post on the pusher clone
Krista https://github.com/Rystakei Josh https://github.com/nupejosh Taylor https://github.com/taylor