{"id":49280,"library":"sc-publish-out-queue","title":"SC Publish Out Queue","description":"SocketCluster middleware that queues outgoing publish messages and emits them in batches to avoid overwhelming the socket. Current stable version 0.2.2 (released November 2017). Provides configurable timeout, batch size, and debug mode. Differs from plain socket.publish by batching messages with timeout control, reducing network churn in high-throughput SocketCluster applications. No updates since 2017; works with SocketCluster v5/v6, but not actively maintained.","status":"maintenance","version":"0.2.2","language":"javascript","source_language":"en","source_url":"https://github.com/happilymarrieddad/sc-publish-out-queue","tags":["javascript","SocketCluster","Publish","Queue"],"install":[{"cmd":"npm install sc-publish-out-queue","lang":"bash","label":"npm"},{"cmd":"yarn add sc-publish-out-queue","lang":"bash","label":"yarn"},{"cmd":"pnpm add sc-publish-out-queue","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime dependency to attach queue middleware to worker","package":"sc-publish-out-queue","optional":false}],"imports":[{"note":"Package exports a single function; named import fails because it's not a named export. Use default import for ESM or require() directly for CJS.","wrong":"const { attach } = require('sc-publish-out-queue')","symbol":"default","correct":"import attach from 'sc-publish-out-queue'"},{"note":"Package declares no module field; default import works in bundlers that handle CJS interop, but many TS configs require 'esModuleInterop'.","wrong":"import scPublishOutHandler from 'sc-publish-out-queue'","symbol":"require","correct":"const scPublishOutHandler = require('sc-publish-out-queue')"},{"note":"attach is the only method; destructuring from require() is sugar. Both work, but destructuring is cleaner.","wrong":"const attach = require('sc-publish-out-queue').attach","symbol":"attach","correct":"const { attach } = require('sc-publish-out-queue')"}],"quickstart":{"code":"const scPublishOutHandler = require('sc-publish-out-queue');\n\n// Inside SocketCluster worker\nscPublishOutHandler.attach(worker, {\n  debug: false,              // log queue actions\n  timeout: 10,               // ms between batches (default 10)\n  numOfMessagesPerPass: 100  // messages per batch (default 100)\n});\n\n// Now socket.publish('channel', data) will be queued and emitted in batches","lang":"javascript","description":"Shows how to attach the publish queue middleware to a SocketCluster worker with custom options."},"warnings":[{"fix":"Upgrade to v0.2.2 or later.","message":"Socket not connected check added in v0.2.2; earlier versions might emit to disconnected sockets causing errors.","severity":"gotcha","affected_versions":"<0.2.2"},{"fix":"Consider alternative: implement custom batching with sc-channel or raw socket events.","message":"Package not updated since 2017; may be incompatible with SocketCluster v7+ (which moved to TypeScript and changed APIs).","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Only use inside SocketCluster worker initialization.","message":"Requires worker context; attaching in a broker or client context silently fails.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'0.2.2':25 '2017':28,59 'activ':66 'applic':55 'avoid':18 'batch':16,32,42 'churn':49 'configur':30 'control':46 'current':22 'debug':35 'differ':37 'emit':13 'high':52 'high-throughput':51 'javascript':68 'maintain':67 'messag':11,43 'middlewar':6 'mode':36 'network':48 'novemb':27 'outgo':9 'overwhelm':19 'plain':39 'provid':29 'publish':2,10,70 'queue':4,8,71 'reduc':47 'releas':26 'sc':1 'sinc':58 'size':33 'socket':21 'socket.publish':40 'socketclust':5,54,62,69 'stabl':23 'throughput':53 'timeout':31,45 'updat':57 'v5/v6':63 'version':24 'work':60","created_at":"2026-06-07T17:00:57.950626+00:00","updated_at":"2026-06-07T17:00:57.950626+00:00","problems":[{"fix":"Use: const scPublishOutHandler = require('sc-publish-out-queue'); scPublishOutHandler.attach(worker, options);","cause":"Wrong import method: destructured named export instead of default import or full require.","error":"TypeError: scPublishOutHandler.attach is not a function"},{"fix":"Run: npm install sc-publish-out-queue --save","cause":"Package not installed or missing from node_modules.","error":"Error: Cannot find module 'sc-publish-out-queue'"},{"fix":"Use only inside worker file (e.g., worker.js) where 'worker' is passed to the function.","cause":"attach called outside SocketCluster worker context.","error":"ReferenceError: worker is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/happilymarrieddad/sc-publish-out-queue#readme","github":"https://github.com/happilymarrieddad/sc-publish-out-queue","docs":null,"changelog":null,"pypi":null,"npm":"sc-publish-out-queue","openapi_spec":null,"status_page":null,"smithery":null,"categories":["messaging"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}