addEventListener(type, fn) {
            if (typeof type !== "string") {
                throw new TypeError(`Expected string, got ${typeof type}`);
            }
            if (typeof fn !== "function") {
                throw new TypeError(`Expected function, got ${typeof fn}`);
            }
            if (!this.eventListeners.hasOwnProperty(type)) {
                throw new Error(`Unrecognised event type ${type}`);
            }
            this.eventListeners[type].add(fn);
        }
Add an event callback function. Supported message types are
"connect", "close", and "message" (for ``RecvChannel``).

@param {string} type - Message type.
@param {Function} fn - Callback function. This is called
with an event-like object, with ``type`` and ``data``
properties.