{"id":"a8d0dd6eeba15a45","repo":"socketio/socket.io","slug":"acknowledgements-are-not-supported","errorCode":null,"errorMessage":"Acknowledgements are not supported","messagePattern":"Acknowledgements are not supported","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/socket.io-postgres-emitter/lib/index.ts","lineNumber":526,"sourceCode":"        close,\n      },\n    });\n  }\n\n  /**\n   * Send a packet to the Socket.IO servers in the cluster\n   *\n   * @param ev - the event name\n   * @param args - any number of serializable arguments\n   */\n  public serverSideEmit<Ev extends EventNames<ServerSideEvents>>(\n    ev: Ev,\n    ...args: EventParams<ServerSideEvents, Ev>\n  ): void {\n    const withAck = args.length && typeof args[args.length - 1] === \"function\";\n\n    if (withAck) {\n      throw new Error(\"Acknowledgements are not supported\");\n    }\n\n    this.publish({\n      type: EventType.SERVER_SIDE_EMIT,\n      data: {\n        packet: [ev, ...args],\n      },\n    });\n  }\n}\n","sourceCodeStart":508,"sourceCodeEnd":537,"githubUrl":"https://github.com/socketio/socket.io/blob/ae7fb46e08c5ed964b4a1ea8b1703e816511598e/packages/socket.io-postgres-emitter/lib/index.ts#L508-L537","documentation":"Thrown by the postgres-emitter's serverSideEmit() when the last argument is a function (an acknowledgement callback). The postgres emitter (and the multi-server emit pattern generally) is fire-and-forget across the cluster via pg_notify, which has no request/response channel to deliver acknowledgements, so ack callbacks are unsupported.","triggerScenarios":"Calling emitter.serverSideEmit('event', arg1, (response) => {...}) — i.e. passing a function as the final argument.","commonSituations":"Treating serverSideEmit like socket.emit (which supports acks) or like the main server's serverSideEmit (which DOES support acks via the cluster adapter); copy-pasting an ack-style call into the postgres emitter.","solutions":["Remove the acknowledgement callback from the serverSideEmit call; use it purely for fire-and-forget messaging.","If you need responses from other servers, use the main Socket.IO server's serverSideEmit/serverSideEmitWithAck with the Postgres adapter attached to the server (not the standalone emitter)."],"exampleFix":"// before\nemitter.serverSideEmit('ping', (res) => { /* unsupported */ });\n\n// after\nemitter.serverSideEmit('ping'); // fire-and-forget","handlingStrategy":"validation","validationCode":"function noAck(args){ return !(args.length && typeof args[args.length-1]==='function'); }","typeGuard":"function isAckFree(args){ return args.length===0 || typeof args[args.length-1]!=='function'; }","tryCatchPattern":null,"preventionTips":["Never pass a callback to the postgres emitter's serverSideEmit.","Use the main server's serverSideEmitWithAck (with the Postgres adapter) when acks are needed.","Remember: standalone emitters are fire-and-forget only."],"tags":["emitter","postgres","acknowledgement","cluster"],"analyzedSha":"ae7fb46e08c5ed964b4a1ea8b1703e816511598e","analyzedAt":"2026-08-03T19:08:14.127Z","schemaVersion":2}