https://github.com/JohnMcLear/ep_rtc/blob/master/handleMessage.js#L36 is probably the best way to answer your question