This will store the received WebSocket message, right? If I understand this correctly, it can be of arbitrary length: http://stackoverflow.com/questions/20652194/websocket-frame-size-limitation , in which case we should allocate it to heap instead on the stack, since the stack is very small in size.