Skip to content


Subversion checkout URL

You can clone with
Download ZIP
An example of using phpws (websocket) to make a file streamer. Client & server side example is provided. Original library code in the link below. Works with the latest Chrome.
Branch: master


latest commit f52b2e006d
Joyce Chan authored

File Streamer (server & client) Sample

Based on

based on code from phpws, which is a php based websocket library


  • apache & php
  • ability to listen on port 12345, used by websocket
  • a web browser
  • on windows, make sure that the hosts file contains the line with loalhost

Tested on

  • Windows 7
  • with latest Xampp for Windows, a bundled php/apache package for windows, comes w/ php 5.4
  • Chrome 22, which is the latest as of time of writing.


  • You can put the php files under /var/www/html in linux or somewhere in htdocs if running on windows
  • and create the text file to be streamed called sendme.txt in c:\tmp\sendme.txt or /tmp/sendme.txt with the correct read permissions

Running the server

  • go to the directory where the php files are and run

    php -q demo.php

Running the client

Something went wrong with that request. Please try again.