switchable secure mode

Hello!
Want to add option for starting https with wss instead of http server with ws.

Minor changes - new feature. Some people may need this. For example we need secure websockets now for testing :) 
Tried not to break coding style/modularization.
And big thanks for original :)