Parse nodejs zlib websocket content into as3 bytearray

I have an app that uses nodejs to deflate some content and send it to flash via websocket. The problem I'm coming across is that when I get a response from nodejs I can't put it into a Bytearray to inflate it.

Here's some of the actionscript:

//Called on receiving data from websocket
function onMessage(event:Event):void {
    var bytes:ByteArray = event.data as ByteArray
    bytes.inflate(); //FAIL....Can't inflate NULL
}

I suspect it has something to do with the encoding. I've tried both binary and utf-8 encoding from nodejs.

I was wondering if anybody was able to get zlib compression working with websockets, or perhaps know of an example. I couldn't really find anything on google that fit my situation.

Any help is appreciated. Thanks.