rails_live_reload icon indicating copy to clipboard operation
rails_live_reload copied to clipboard

Support manually triggering a page reload from an external process

Open nogweii opened this issue 1 year ago • 1 comments

I am running guard on my laptop. It is monitoring changes to the files underneath config/ & lib/, and causes the whole server to restart.

I'd like to have the page reload after the server is restarted, but I'm not sure how to trigger that from something outside the rails process. Here was my first attempt at it:

require "socket"
require "json"

command = {
  "event" => "reload",
  "files" => ["app/assets/builds/application.js"]
}

socket = UNIXSocket.new("tmp/sockets/rails_live_reload.sock")
socket.puts command.to_json

nogweii avatar Dec 05 '23 07:12 nogweii

Hello @nogweii, sorry for taking a lot of time to reply.

I don't think it is possible to do at the moment, for this, Unix server has to be updated here so that it will be able to receive commands from connections, as right now it can only "transmit" commands.

manastyretskyi avatar Dec 12 '23 13:12 manastyretskyi