"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.transport = exports.makeTransport = void 0;
function makeTransport(options) {
    return {
        isReady() {
            return true;
        },
        onReady(socket, callback) {
            socket.on('ready', callback);
            return () => socket.off('ready', callback);
        },
        onMessage(socket, callback) {
            socket.on(options.events.message, callback);
            return () => socket.off(options.events.message, callback);
        },
        onClose(socket, callback) {
            socket.on('close', callback);
            return () => socket.off('close', callback);
        },
        onError(socket, callback) {
            socket.on('error', callback);
            return () => socket.off('error', callback);
        },
        send(socket, data) {
            socket.emit(options.events.emit, data);
        },
    };
}
exports.makeTransport = makeTransport;
exports.transport = makeTransport({ events: { message: 'incoming-message', emit: 'outgoing-message' } });
exports.default = exports.transport;
