An intro to web sockets.
We continue to use QUnit to define tests that you should attempt to complete.
The automated tests are with npm
on the command line; part of the task is to
create a web page that you'll have to test by looking if it's doing the right
thing.
The usual steps to install the source code and the test framework and then run the tests from the command line:
- To download the code, either use git (the simplest option):
git clone https://github.com/portsoc/ws_ws.git
cd ws_ws
or download and unpack the zip which on linux can be achieved using
wget https://github.com/portsoc/ws_ws/archive/master.zip
then
unzip master.zip
cd ws_ws-master
- To download the QUnit files (and any libraries it uses, which you need to do before the first run of tests, but just the once) type:
npm install
- Run the tests by typing:
npm test
-
Inside
test.js
you will find helpful comments that tell you what the tests expect. -
The file
test.html
contains a client-side simple test that your server is sending messages. To use it, opentest.html
in your browser, or copytest.html
andassess.ws.js
intoworksheet/webpages
and then go to http://your-ip/test.html
If at all possible, we recommend you use git to download code rather than zips
of a repository. This is preferable because if the repo is updated, then
syncing those changes requires just one command (git pull
) and usually any
merging can be done automatically. Git is very powerful and we heartily
encourages you to become familiar with it.