| 1 |
"use strict"; |
| 2 |
|
| 3 |
Object.defineProperty(exports, "__esModule", { |
| 4 |
value: true |
| 5 |
}); |
| 6 |
exports["default"] = void 0; |
| 7 |
var _net = babelHelpers.interopRequireDefault(require("net")); |
| 8 |
var _events = require("events"); |
| 9 |
var _binarySerializer = babelHelpers.interopRequireDefault(require("./helpers/binary-serializer")); |
| 10 |
// import ... |
| 11 |
var Connection = /*#__PURE__*/function (_EventEmitter) { |
| 12 |
babelHelpers.inherits(Connection, _EventEmitter); |
| 13 |
var _super = babelHelpers.createSuper(Connection); |
| 14 |
function Connection(endpoint, joinKey, joinData, roomId) { |
| 15 |
var _this; |
| 16 |
babelHelpers.classCallCheck(this, Connection); |
| 17 |
_this = _super.call(this); |
| 18 |
_this.isConnected = false; |
| 19 |
_this.roomId = roomId; |
| 20 |
|
| 21 |
// ... |
| 22 |
return _this; |
| 23 |
} |
| 24 |
babelHelpers.createClass(Connection, [{ |
| 25 |
key: "send", |
| 26 |
value: function send(message) { |
| 27 |
this.sock.write(_binarySerializer["default"].serializeMessage(message)); |
| 28 |
} |
| 29 |
}, { |
| 30 |
key: "disconnect", |
| 31 |
value: function disconnect() { |
| 32 |
this.sock.close(); |
| 33 |
} |
| 34 |
}]); |
| 35 |
return Connection; |
| 36 |
}(_events.EventEmitter); |
| 37 |
exports["default"] = Connection; |