Conditionally restrict communication

- if a test function is passed in, only allow communication if the test returns true
- if no test function passed in, behaviour is unchanged
- test function receives messageEvent object as a param
- test case to ensure that allowed function properly restricts communication
- updated readme