diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 5c72b61..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "env": { - "es6": true - }, - "extends": ["airbnb-base", "prettier"], - "globals": { - "Atomics": "readonly", - "SharedArrayBuffer": "readonly" - }, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": 2018, - "sourceType": "module", - "allowImportExportEverywhere": true - }, - "plugins": [ - "prettier", - "@typescript-eslint" - ], - "rules": { - "prettier/prettier": "error", - "class-methods-use-this": [ - "error", - {"exceptMethods": ["requestDidStart", "willSendRequest", "willSendResponse", "errorFromResponse"]} - ], - "camelcase": 0, - "no-undef": 0, - "no-new": 0, - "no-shadow": 0, - "@typescript-eslint/no-shadow": ["error", { "allow": ["err"] }], - "no-console": "off", - "no-use-before-define": "warn", - "no-constant-condition": "off", - "import/no-unresolved": "off", - "import/prefer-default-export": "warn", - "import/extensions": "off", - "class-methods-use-this": "off", - "@typescript-eslint/array-type": [2, { "default": "array" }], - "@typescript-eslint/consistent-type-definitions": [2, "interface"], - "@typescript-eslint/no-explicit-any": "error", - "@typescript-eslint/no-for-in-array": "error", - "@typescript-eslint/no-inferrable-types": "error", - "@typescript-eslint/no-use-before-define": "warn", - "no-unused-vars": "off", - "@typescript-eslint/no-unused-vars": "warn", - "no-underscore-dangle": "off", - "prefer-destructuring": "off" - }, - "settings": { - "import/extensions": [".js", ".ts"], - "import/parsers": { - "@typescript-eslint/parser": [".ts", ".tsx"] - } - } -} diff --git a/package.json b/package.json index 7496577..460c438 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ts-osc", - "version": "0.3.1", + "version": "0.3.2", "description": "Fully TypeScript-native OSC Client based on osc-min", "main": "./lib/index.js", "types": "./lib/index.d.ts", diff --git a/src/oscClient.ts b/src/oscClient.ts index 5c7ec92..a8774d9 100644 --- a/src/oscClient.ts +++ b/src/oscClient.ts @@ -19,7 +19,7 @@ export class OSCClient { this.socket = dgram.createSocket({ type: 'udp4', reuseAddr: true }); } - private sendPacket(packet: Buffer): void { + public sendPacket(packet: Buffer): void { this.socket.send(packet, 0, packet.length, this.port, this.host); } diff --git a/src/oscServer.ts b/src/oscServer.ts index 97b6cf2..c4ebbbc 100644 --- a/src/oscServer.ts +++ b/src/oscServer.ts @@ -15,7 +15,7 @@ export declare interface OSCServer { Emitted whenever an OSC message is received on inPort @event */ - on(event: 'message', listener: (message: ReceivedOSCMessage) => void): this; + on(event: 'message', listener: (message: ReceivedOSCMessage) => void): this; /** Emitted when OSC client is listening on inPort @@ -52,7 +52,11 @@ export class OSCServer extends EventEmitter { super(); this.socket = dgram.createSocket({ type: 'udp4', reuseAddr: true }); - this.socket.bind(port, bindAddress); + this.socket.bind({ + port, + address: bindAddress, + exclusive: true, + }); this.socket.on('listening', () => { this.emit('listening');