encode_message method should be parameterised

Since encode_message is using data in send queue, we either don't send the data (e.g. websocket.send(encode_message());)
or better to have a parameter.