Refactored event system

Refactored event system so that event listemers must be registered
Added levels to logging
Removed old caching queue class
Removed logging class into example app implementation
Implemented stream_* instead of socket_*

Implemented stream_* instead of socket_*
Implemented proper non-blocking behaviour
Prepared for TLS support
Minor consistency improvements (shorthand arrays, naming, remove dead
code)
Partial crypto implementation

Crypto works, handshake doesn't.
Needs buffering mechanism for HTTP processor.
Made SSL actually work

SSL now works, although still not foolproof, more commits to come
Refactored handshake and message processing

Incomplete, will not run!
Finished refactoring
Merge pull request #1 from DaveRandom/refactoring

Refactoring
Merge branch 'master' of https://github.com/DaveRandom/WebSocketDemo into DaveRandom-master

Conflicts:
	public/index.php
	public/js/main.js