Search code examples
phpportguardlivereloadcodio

Running Guard Livereload in a Codio box


I am trying to run guard-livereload on my Codio box.

The problem is when ever I "run" the project I get a CONNECTION_REFUSED error in my browser console.

I am not sure what is doing this as I have changed the port into the Codio range and set the file to watch for PHP files:

# A sample Guardfile
# More info at https://github.com/guard/guard#readme

guard 'livereload', :port => '4000' do
  watch(%r{.+\.(css|js|html|php)$})
end

I also have included this file in all my pages:

<script type="text/javascript" src="http://0.0.0.0:4000/livereload.js"></script>

When I run guard it is waiting for a browser to connect.


Solution

  • In codio box you have a domain name associated with your project: .codio.io, you can find it in IDE menu Project->Box Info. You should use it in your client code to include the livereload.js file. example (my bo domain is rebold-bogard):

    <script type="text/javascript" src="http://rebold-bogard.codio.io:4000/livereload.js"></script>
    

    0.0.0.0 address is for binding on server side. By default guard binds 0.0.0.0, this mean nothing to change here, only think you should be mind of is a notification library, you should use libnotify to track codio changes.