fix crash on nil pointer to mutex
initial rough implementation of websocket support