Skip to content

knguyen0125/socket-refresh-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Demo of Restarting php pages with Express and Socket.IO

Start

# Use nodemon to watch php files
npm dev
# Create a standalone php server
npm php

For any pages that you wish to reload on change, add this block to end of php file

<?php include('restart/restartBlock.php') ?>

// OR 

<script src="restart/socket.io.js"></script>
<script src="restart/restart.js"></script>

Standalone projects

Copy restart folder in public to target

Install nodemon, express and socket.io

yarn add nodemon express socket.io

Scripts to run

# Activate Nodemon to watch the server
yarn nodemon --config public/restart/server.js
# Create local php server
php -S localhost:8080 -t public

Link socket.io.js (Socket.IO client) and restart.js (small script for restart)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published