UTF-8 check in node.js server side code is not working

I've implemented some simple code to handle websockets via node.js. All is fine except for the utf-8 validation check:

websocket.on('message', function(message) {
   if(message.type == 'utf-8') {
      console.log('Received Message: ' + message.utf8Data);
      websocket.send('Server received your message: ' + message.utf8Data);
   }
});

When I test this, the server opens up a connection to me but it does not send anything back. If I test this with just:

websocket.on('message', function(message) {

    console.log('Received Message: ' + message);
    websocket.send('Server received your message: ' + message);

});

I get: Server received your message: [Object] [object]

How do I get to the data of the message? I've updated websockets to the latest version but I can't quite follow the documentation to find an answer to why the utf-8 check fails.

Thanks.