More generic message handling
Remainder fixes for websocket support