(message)
| 245 | } |
| 246 | |
| 247 | async message(message) { |
| 248 | if (!this.isRpc) throw new BadRequestError('Only RPC operations are supported'); |
| 249 | if (typeof message === 'string') { |
| 250 | try { |
| 251 | message = JSON.parse(message); |
| 252 | } catch (e) { |
| 253 | throw new BadRequestError('Invalid message'); |
| 254 | } |
| 255 | } |
| 256 | if (!APIS[message.op]) throw new BadRequestError(`Invalid API operation: ${message.op}`); |
| 257 | if (APIS[message.op].type !== 'Subscription') { |
| 258 | throw new BadRequestError('Only subscription operations are supported'); |
| 259 | } |
| 260 | handleArguments(message); |
| 261 | const result = await this.ctx.api.execute( |
| 262 | this, message.op, message.args, (m, args) => (this.ctx.parallel as any)(m, args), message.projection, |
| 263 | ); |
| 264 | this.send(result); |
| 265 | } |
| 266 | |
| 267 | async cleanup() { |
| 268 | await this.dispose?.(); |
nothing calls this directly
no test coverage detected