shorty.js implements an adaptive huffman algorithm that will allow you to efficiently compress streams of short strings without buffering, like the updates to your player's position, or chat messages ..
Info, Docs and live sample on my blog : https://enkimute.github.io/shorty.js/