Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Error Messages when using Susie reply event #67

Open
chattes opened this issue May 22, 2018 · 0 comments
Open

Get Error Messages when using Susie reply event #67

chattes opened this issue May 22, 2018 · 0 comments

Comments

@chattes
Copy link

chattes commented May 22, 2018

Version: 2
Hi,
I am using version 2 and we get this error in server, although the mssage is delivered.

Debug: internal, implementation, error 
    Error: write after end
    at writeAfterEnd (_stream_writable.js:236:12)
    at PassThrough.Writable.write (_stream_writable.js:287:5)
    at Object.internals.writeEvent (/home/ubuntu/bot-farm/node_modules/susie/lib/index.js:14:16)
    at Function.internals.handleEvent (/home/ubuntu/bot-farm/node_modules/susie/lib/index.js:69:15)
    at bound (domain.js:301:14)
    at Function.runBound [as event] (domain.js:314:12)
    at Redis.Subscriber.on (/home/ubuntu/bot-farm/routes/proxy/chatSSE.js:24:15)
    at emitTwo (events.js:130:20)
    at Redis.emit (events.js:213:7)
    at Redis.exports.returnReply (/home/ubuntu/bot-farm/node_modules/ioredis/lib/redis/parser.js:107:14)
    at JavascriptRedisParser.returnReply (/home/ubuntu/bot-farm/node_modules/ioredis/lib/redis/parser.js:27:13)
    at JavascriptRedisParser.execute (/home/ubuntu/bot-farm/node_modules/redis-parser/lib/parser.js:574:12)
    at Socket.<anonymous> (/home/ubuntu/bot-farm/node_modules/ioredis/lib/redis/event_handler.js:107:22)
    at emitOne (events.js:115:13)
    at Socket.emit (events.js:210:7)
    at addChunk (_stream_readable.js:266:12)

This is the route code

  handler: (req, reply) => {
    const { query: { user: channel } } = req
    console.log('Received Ping', channel)
    let payload = req.payload
    // const stream = new PassThrough({ objectMode: true })
    if (R.not(R.isNil(Subscriber))) {
      Subscriber.on('message', (channel, message) => {
        const messageParsed = JSON.parse(message)
        reply.event({ event: channel, data: messageParsed })
        // stream.write({ data: messageParsed })
      })
      Subscriber.subscribe(channel)
    }
    reply.event({ event: channel, data: null })
    // reply.event(stream, null, { event: channel })
  },

When I use stream it does not come, although stream mixes up multiple clients connecting to the server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant