Bug/sockets

Fix many bugs related sockets handing. Enhance grunt file for simpler development cycle.